If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > trigger runtime problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-04, 13:46
highhighs highhighs is offline
Registered User
 
Join Date: May 2004
Posts: 3
trigger runtime problem

im having trouble in running a trigger ive created, the errors are ( at runtime)

SQL> update leds set price = price + 1 where color = 'White';
update leds set price = price + 1 where color = 'White'
*
ERROR at line 1:
ORA-04091: table SYSTEM.LEDS is mutating, trigger/function may not see it
ORA-06512: at "SYSTEM.LEDPRICECHANGE", line 5
ORA-06512: at "SYSTEM.LEDPRICECHANGE", line 10
ORA-04088: error during execution of trigger 'SYSTEM.LEDPRICECHANGE'




the trigger code is :
[Code:]
CREATE OR REPLACE TRIGGER LedPriceChange
AFTER UPDATE OF price ON Leds
FOR EACH ROW
WHEN (new.price > old.price)

DECLARE
diff INTEGER;
color Leds.color%TYPE;
CURSOR colors IS
select DISTINCT Leds.color
from Leds
where color = :new.color;
rt Leds.color%TYPE;
BEGIN
open colors;
diff := (:new.price - ld.price)*100/(ld.price); --get the percentage diff

while(colors%FOUND) loop
FETCH colors INTO rt;
incr_Back_L_price(diff,rt);
incr_Front_L_price(diff,rt);
end loop;
close colors;
END;
.
run;
[/CODE]

what does this error mean? im a newbi at this ( on oracle 10g).

thank you
Reply With Quote
  #2 (permalink)  
Old 05-21-04, 13:49
gbrabham gbrabham is offline
Registered User
 
Join Date: Apr 2003
Location: Greenville, SC (USA)
Posts: 1,155
A trigger on a specific table cannot reference that table in the trigger body ...
ie,

create trigger ...
on led

declare

select ... from led....

HTH
Gregg
Reply With Quote
  #3 (permalink)  
Old 05-21-04, 17:38
highhighs highhighs is offline
Registered User
 
Join Date: May 2004
Posts: 3
ohh thanks i thought i just cant modify the table in a trigger . im taking intro to db now so im still at the basics . thank again
Reply With Quote
  #4 (permalink)  
Old 05-21-04, 17:45
dbtoo2001 dbtoo2001 is offline
Registered User
 
Join Date: Jan 2004
Location: Scottsdale, AZ
Posts: 106
__________________
"Take Control!
Make The Choice!
Accept The Consequences!
Deal With The Results! "
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On