TRIGGER PROBLEM
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: TRIGGER PROBLEM

  1. #1
    Join Date
    Mar 2001
    Posts
    13

    Unhappy

    Hi,

    I am getting ' mutation table' error in a trigger .
    I saw one old similar article of 27th march ,but did not see
    the appropriate reply to this question.
    I have two tables, I want to put After insert trigger into
    table T1 where ........

    Select T1.car_ctl_nbr into control_number from T1 ,T2 where
    T1.car_init = T2.car_init and
    T1.car_nbr = T2.car_nbr ;

    Update T2 set car_ctl_nbr = control_number ;

    When ever I am inserting one record into T1 , I am getting
    mutating table error.
    I want this to be done for each row.

  2. #2
    Join Date
    Jan 2001
    Posts
    515

    Bind variable

    Instead of the select statement I think you are supposed be using the :new.car_ctl_nbr bind variable to update table T2.

  3. #3
    Join Date
    Mar 2000
    Location
    India
    Posts
    3


    Select T1.car_ctl_nbr into control_number from T1 ,T2 where
    T1.car_init = T2.car_init and
    T1.car_nbr = T2.car_nbr ;

    Update T2 set car_ctl_nbr = control_number ;

    Rewrite u r trigger like this

    Dont use the select stmt.

    Update T2 set car_ctl_nbr = :New.car_ctl_nbr Where
    car_init =:New.car_init And
    car_nbr = :New.car_nbr ;

  4. #4
    Join Date
    Mar 2001
    Posts
    13
    Originally posted by kalai


    Select T1.car_ctl_nbr into control_number from T1 ,T2 where
    T1.car_init = T2.car_init and
    T1.car_nbr = T2.car_nbr ;

    Update T2 set car_ctl_nbr = control_number ;

    Rewrite u r trigger like this

    Dont use the select stmt.

    Update T2 set car_ctl_nbr = :New.car_ctl_nbr Where
    car_init =:New.car_init And
    car_nbr = :New.car_nbr ;
    Thanks kalai, Great.....

Posting Permissions

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


Click Here to Expand Forum to Full Width