Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Unanswered: Pls Help.....Triggers Help

    Hi,
    I have a requirement of a trigger which will trim the value of column CAA_NAME as soon as this column is updated.
    I hv written the foll trigger to achieve the same.

    But after the trigger is configured and i try to update caa_name column, I'm getting -

    ora-04091: table caa_ca is mutating,trigger/function may not see it
    ora-06512: at "TRIMCAACC4_MAIN", line 2
    ora-04088: error during execution of trigger


    Pls Help.



    CREATE OR REPLACE TRIGGER TRIMCAACC4_MAIN
    AFTER UPDATE OF
    CAA_NAME
    ON
    CAA_CA
    REFERENCING NEW AS NEW
    FOR EACH ROW
    BEGIN
    UPDATE CAA_CA SET
    CAA_NAME = TRIM(:NEW.CAA_NAME)
    WHERE CAA_CA_ID=:NEW.CAA_CA_ID ;

    END;
    /

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Too complicated and - obviously - wrong. I'd rather do it as
    Code:
    CREATE OR REPLACE TRIGGER TRIMCAACC4_MAIN
      BEFORE UPDATE OF caa_name ON caa_ca 
      FOR EACH ROW 
    BEGIN 
      :NEW.caa_name := TRIM(:NEW.caa_name);
    END;
    /

  3. #3
    Join Date
    Nov 2008
    Posts
    16
    Thanks LittleFoot...this seems to be working.

Posting Permissions

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