If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > problem with new reference in trigger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-29-10, 14:43
josemourinho josemourinho is offline
Registered User
 
Join Date: Aug 2010
Posts: 19
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 ?
Reply With Quote
  #2 (permalink)  
Old 08-29-10, 15:50
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
Removed due to mis reading the problem.

Last edited by Stealth_DBA; 08-29-10 at 16:08.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On