Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    18

    Lightbulb Unanswered: Procedure and triggers

    Hey, i have a big problem. I have 2 tables and each one have 1 trigger.
    Example:
    Table1 have a trigger AFTER SAVE. This trigger call a procedure that make a INSERT on Table2.
    The Table2 have a trigger AFTER SAVE. This trigger call a procedure that make a INSERT on Table1.
    I need this structure because we are remodeling the existing bank and I can not disable the current tables. However, this structure generates a LOOP.
    I thought of passing a parameter indicating the origin of the call, but could not make the TRIGGER recognize the parameter reported. Does anyone have any suggestions for solving this problem? Recalling that the tables are in the same database.

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    add a column to the tables in question, call it triggered or something along those lines with default of 'N'. Have trigger process insert a value of 'Y', then add WHEN condition of WHEN triggered = 'N' then perform insert else null.
    Dave

  3. #3
    Join Date
    Mar 2011
    Posts
    18

    Lightbulb

    So. I even thought about this solution, only that the database has over 3000 tables. My attempt was to find another solution.

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Unless you can tolerate some delay, you could use replication.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Tags for this Thread

Posting Permissions

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