Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Error in creating a trigger: SQLCODE = -104

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Error in creating a trigger: SQLCODE = -104
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: 3158
Location: Tucson AZ

PostPosted: Wed Mar 21, 2007 4:35 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Wed Mar 21, 2007 9:55 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us