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

Exception Handling in Native Stored Procedure


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

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Thu Feb 25, 2016 4:08 am
Reply with quote

I need to employ the following logic in a Native SP (say NSP1).

Code:
INSERT INTO TABLE1

DECLARE EXIT HANDLER FOR SQLEXCEPTION
    CONSTRUCT ERROR MESSAGE
    INSERT ERROR MESSAGE INTO TABLE2(ERROR TABLE)


If the insert into TABLE2 fails for some reason, NSP1 needs to invoke another Native SP (say NSP2) which will display the error details in the spool.

I am not sure how to accomplish this since NSP1 abruptly ends in case of a sql error within the EXIT HANDLER.

Please let me know how to accomplish this using SQL/PL.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2571
Location: NYC,USA

PostPosted: Thu Feb 25, 2016 9:51 pm
Reply with quote

Use
Code:
CONTINUE HANDLER
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 Handling abend to prevent termination CICS 0
No new posts CICS Web services Assistant - Handlin... CICS 3
No new posts DSNTEP2 - setting exception DB2 2
No new posts In JCL Procedure how we can execute R... CLIST & REXX 7
No new posts COBOL Student learning COBOL File Han... COBOL Programming 3
Search our Forums:

Back to Top