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
 
Exception Handling in Native Stored Procedure

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Exception Handling in Native Stored Procedure
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

Senior Member


Joined: 21 Sep 2010
Posts: 2165
Location: NY,USA

PostPosted: Thu Feb 25, 2016 9:51 pm    Post subject:
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    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 Procedure Division Section socker_dad COBOL Programming 2 Wed Jun 12, 2019 12:21 am
No new posts How to DEBUG DB2 Stored Procedures Us... thesumitk DB2 0 Mon Jun 03, 2019 8:26 pm
No new posts Regarding mroe data to be processed i... vinu78 DB2 1 Mon May 27, 2019 7:31 pm
No new posts Can we pass cobol pointer to cobol-db... rohanthengal DB2 4 Tue Mar 19, 2019 1:04 pm
No new posts Array in Cobol Db2 Stored Procedure Ashishpanpaliya DB2 4 Wed Jan 09, 2019 3:06 pm

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