Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2012
    Posts
    9

    Unanswered: problem with trigger

    i have created a trigger and use this

    referencing new_table as inserted;
    begin
    set "asd"=(select col1 from inserted);

    end

    error i am getting -

    The definition of trigger "name" includes an invalid use of correlation name or transition table name "INSERTED". Reason code="4".. SQLCODE=-696, SQLSTATE=42898, DRIVER=3.63.108

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Please see manuals

    SQL0696N
    Code:
    Explanation
    
    The trigger definition included an invalid use of name.
     The value of reason-code identifies the roblem:
    
    ...
    ...
    ...
    
    4
    OLD TABLE name and NEW TABLE name are not allowed in a trigger
     if the trigger is defined using a compound SQL (compiled) statement.
    
    The statement cannot be processed.
    
    ...
    Anyway,
    why do you want to use "NEW TABLE" instead of "NEW"?

  3. #3
    Join Date
    Jul 2012
    Posts
    9
    hi

    i am using ibm data studio.
    when i use begin atomic instead of begin then i am getting this error


    An unexpected token "set "asd" = (select "col1" from" was found following "ey" decimal(16,0)". Expected tokens may include: "
    ".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.63.108

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Please publish your DB2 version/release/fixpack and platform OS
    and whole of your CREATE TRIGGER statement(and CREATE TABLE statement, if necessary).

  5. #5
    Join Date
    Jul 2012
    Posts
    9
    hi

    version is 9.7v and os is windows 7
    sorry cant share the code because it is confidential.

  6. #6
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    sorry cant share the code because it is confidential.
    Data is often confidential - meta-data, maybe not so much.

    Even so, change the "confidential" stuff to something generic, try that, and post anything that is a surprise or unwanted.

  7. #7
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Root cause of a syntax error(SQLCODE=-104) was sometimes laid in earlier than the phrase reported by error message.

Posting Permissions

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