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: 3053
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 Check data with Exception Table DB2 0
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts File Handling COBOL Programming 9
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
Search our Forums:

Back to Top