Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Posts
    29

    Question Unanswered: Trigger problem.

    I have a table T1 which has an insert trigger TR1. In TR1 there is lot of business logic. At least it inserts to 2 other tables and updates onother table. At the end inserted row will be deleted from T1. When I insert a row to T1, triggers works fine(after inserting to 2 table and updating another table, the data will be deleted from T1), but when I insert more one row as follows

    insert T1
    select * from T2

    (both T1 & T2 have same structure) In the above case 2 rows will be inserted to T1, but only one row will be processed and second row is still exists in the table.

    Do you guys know why?

    How to debug a trigger?

    Thanks

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid, Spain
    Posts
    97

    Re: Trigger problem.

    Originally posted by nmr
    When I insert a row to T1, triggers works fine(after inserting to 2 table and updating another table, the data will be deleted from T1), but when I insert more one row as follows

    insert T1
    select * from T2

    (both T1 & T2 have same structure) In the above case 2 rows will be inserted to T1, but only one row will be processed and second row is still exists in the table.
    In ASE, triggers fire once per insert statement (same for
    update and delete). For the statement above, the trigger
    will fire once and all the inserted rows are made available
    to the trigger as rows in "inserted". Probably your trigger is
    not coded to expect several rows in the "inserted"
    virtual table.

    Regards,
    Mariano Corral

Posting Permissions

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