Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    19

    Unanswered: problem with new reference in trigger

    hello
    i use db2 express c
    i want to create trigger and i want to use new reference
    the code is:
    CREATE TRIGGER IBM.TRIGGER_TRIG17
    AFTER INSERT
    ON IBM.AMD
    REFERENCING
    NEW AS NEW
    FOR EACH ROW
    MODE DB2SQL
    BEGIN ATOMIC
    declare VAR_KEY_FIELDS integer;

    if (user != 'db2admin') then
    set VAR_KEY_FIELDS = nextval for ibm.seq1;


    insert into replication.KEY_FIELDS values (1,1,NEW.id1,1);
    end if;
    /* Trigger body */
    END;

    i get this error:
    Message: [IBM][CLI Driver][DB2/NT] SQL0206N "NEW.ID1" is not valid in the context where it is used. LINE NUMBER=16. SQLSTATE=42703
    SQL: CREATE TRIGGER IBM.TRIGGER_TRIG1755

    what the problem is ?

  2. #2
    Join Date
    May 2009
    Posts
    508
    Provided Answers: 1
    Removed due to mis reading the problem.
    Last edited by Stealth_DBA; 08-29-10 at 17:08.

Posting Permissions

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