08-22-03, 18:48 #1Registered User
- Join Date
- Aug 2003
Unanswered: Trigger with BEGIN ATOMIC and @ terminator
I'm trying to condense two trigger statements into one because i thought it was possible. I've read a few previous posts but still can't get it to work: (I don't seem to be very good with triggers in DB2!)
CREATE TRIGGER order_update AFTER INSERT ON order REFERENCING NEW AS new FOR EACH ROW MODE DB2SQL BEGIN ATOMIC UPDATE customer SET balance_owed = balance_owed + (qty*(SELECT price FROM book b, customer c WHERE new.cno = c.cno AND new.bno = b.bno)) WHERE new.cno = c.cno; UPDATE book b SET sales = sales + new.qty WHERE new.bno = b.bno; END@
but using this code i get the following error -
An unexpected token "END-OF-STATEMENT" was found following "HERE
new.cno = c.cno". Expected tokens may include: "<interval_qualifier>".
and have no idea what it means / how to solve it.
Any help appreciated,
08-22-03, 20:32 #2Super Moderator
- Join Date
- Aug 2001
Re: Trigger with BEGIN ATOMIC and @ terminator
I have never been successful in understanding Command Centre ...
So, I put them in a flat-file and run it from command line ...
Copy the trigger text to a file and name it , say C:\trigger.sql
Open DOS prompt, type in db2cmd ... In the new window, navigate to C:\ and then
db2 -td@ -f trigger.sql
td@ tells db2 to use @ as the delimiter
SathyaramVisit the new-look IDUG Website , register to gain access to the excellent content.