Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    3

    Unanswered: 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

  2. #2
    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

  3. #3
    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

  4. #4
    Join Date
    Jan 2004
    Location
    Scottsdale, AZ
    Posts
    106
    "Take Control!
    Make The Choice!
    Accept The Consequences!
    Deal With The Results! "

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •