Results 1 to 4 of 4

Thread: trigger

  1. #1
    Join Date
    Nov 2003
    Posts
    20

    Exclamation Unanswered: trigger

    hello people,
    i should create a trigger that insert the record in ADMIN.ANAMAGA_TMP after an insert in my table ADMIN.ANAMAGA. the db i db2 version 7. can you help me thanks thi is my code:
    CREATE TRIGGER ADMIN.REPLICA AFTER INSERT ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL INSERT INTO
    ADMIN.ANAMAGA_TMP
    (
    CODICE
    )
    VALUES
    (
    'codice'
    )
    but my result in ADMIN.ANAMAGA_TMP in the column CODICE is codice and not a value for example 1223.

    anamaga is composed from
    CODICE DESCRIZION TIPO
    anamaga_temp is equal to anamaga (the some column).
    when I insert a new one row in anamaga i would like to insert the row in anamaga_tmp in order to extract only new data.
    Last edited by lullo; 07-12-04 at 12:42.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What are you inserting into ADMIN.ANAMAGA and what do you want to appear in ADMIN.ANAMAGA_TMP. Please include the layouts of the two tables.

    Andy

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The way I read what you want is that ADMIN.ANAMAGA_TMP is a log of only the new rows added to ADMIN.ANAMAGA. If this is true, then your trigger would be:

    CREATE TRIGGER ADMIN.REPLICA AFTER INSERT ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL INSERT INTO
    ADMIN.ANAMAGA_TMP VALUES (n.CODICE,n.DESCRIZION,n.TIPO)

    Andy

  4. #4
    Join Date
    Nov 2003
    Posts
    20
    thanks andy it's running

Posting Permissions

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