Results 1 to 2 of 2

Thread: Trigger - Insert

  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Trigger - Insert

    Hi All

    I am doing an assignment and i am stuck on my trigger, basically i want to fire a trigger that when an insert occurs on a table that the trigger finds the id of the insert and returns the value into a package.

    CREATE OR REPLACE TRIGGER insert_act_trg
    AFTER INSERT ON cl_activity
    FOR EACH ROW
    BEGIN
    SELECT act_proj_id
    INTO check_budget_pkg.v_proj_id
    FROM cl_activity
    WHERE act_id = :NEW.act_id;

    END;
    /

    when i run the insert dmL it returns an error statment say that mutating occurs, i've tried various ways of getting round this but my head now hurts! please, please help me!!!!

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Is this the complete code for the trigger?. Mutating error occurs if you are updating the row that fired the trigger within the trigger code.

    You will need to create statement level trigger rather than row level trigger to get around it. It will fire only once no matter how many rows are affected, so you have to build your trigger code to account for that.

Posting Permissions

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