Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts FUSE - IBM MQ - CICS integration error Kevin Vaz CICS 1 Mon Sep 18, 2017 4:31 pm
No new posts Reply MQ open error Vignesh Sid COBOL Programming 6 Thu Sep 07, 2017 6:02 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us