IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Error in creating a trigger: SQLCODE = -104


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
itzbalajee

New User


Joined: 11 Aug 2006
Posts: 5
Location: Chennai

PostPosted: Wed Mar 21, 2007 3:00 pm
Reply with quote

Hi,

I tried to create a trigger for the ERM_DET table.I got the error (given below). Please help me.



[color=darkred]create trigger emptr001 after insert on emp_det referencing new as e01
for each row mode db2sql when (e01.emp_id > spaces)
begin atomic insert into emp_det_audit
values(e01.emp_id,e01.emp_name,'emptr001');
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "END". SOME SYMBOLS THAT MIGHT
BE LEGAL ARE: ;
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHLEX SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 502 0 0 -1 284 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'000001F6' X'00000000' X'00000000' X'FFFFFFFF'
X'0000011C' X'00000000' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------+
[/color]
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Mar 21, 2007 4:35 pm
Reply with quote

You are missing the "END" ant the end of the trigger body.
Back to top
View user's profile Send private message
itzbalajee

New User


Joined: 11 Aug 2006
Posts: 5
Location: Chennai

PostPosted: Wed Mar 21, 2007 7:54 pm
Reply with quote

Hi,

Thanks for your reply.

But now i am getting this error

---------+---------+---------+---------+---------+---------+---------+---------+
create trigger emptr001 after insert on emp_det referencing new as e01
for each row mode db2sql when (e01.emp_id > spaces)
begin atomic insert into emp_det_audit
values(e01.emp_id,e01.emp_name,'emptr001');end;
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL " ". SOME SYMBOLS THAT MIGHT
BE LEGAL ARE: QUOTE
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHLEX SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 502 0 0 -1 158 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'000001F6' X'00000000' X'00000000' X'FFFFFFFF'
X'0000009E' X'00000000' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------+
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Mar 21, 2007 9:55 pm
Reply with quote

What is the purpose of the last semicolon?
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Thu Mar 22, 2007 10:31 am
Reply with quote

Remove the semicolon before to END and become familiar with the syntax. You can find it in manuals.
Back to top
View user's profile Send private message
senthilssg

New User


Joined: 09 Dec 2005
Posts: 64
Location: USA

PostPosted: Mon Apr 02, 2007 3:51 pm
Reply with quote



Hi ,

You will have use set terminator statement to diiferentiate your end of trigger and termination of sql query in triggered action .

Sample code for trigger :

Code:

--#SET TERMINATOR @ ;[/b]
--CREATE TRIGGER TRIG_DEL_EMP
--      AFTER DELETE ON EMP99999
--      FOR EACH ROW MODE DB2SQL
--      BEGIN ATOMIC
--        UPDATE COMPANY_STATS SET NO_OF_EMP=NO_OF_EMP-1 ;
--      END @
--#SET TERMINATOR ;




I hope this help you

Regards
senthil
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Creating Unix Directory using COBOL i... COBOL Programming 2
No new posts Error while running web tool kit REXX... CLIST & REXX 5
Search our Forums:

Back to Top