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: 1938
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 Handling result sets in the calling N... Rusikesh DB2 7 Fri Apr 13, 2018 12:25 am
No new posts CICS web service from DB2 Triggers or... kiranprasad DB2 2 Wed Dec 20, 2017 11:10 am
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm

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