If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > error handler

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-17-10, 13:36
zinkjo zinkjo is offline
Registered User
 
Join Date: Jan 2004
Posts: 9
error handler

i have the following handler:

DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
DECLARE sMsg VARCHAR(8000) DEFAULT '';
GET DIAGNOSTICS EXCEPTION 1 sMsg = MESSAGE_TEXT;
SET sPolicyMsgs = sTableNm || ' Failed: ' || sMsg;
ROLLBACK WORK TO SAVEPOINT policyUOW;
UPDATE error_tbl ...; COMMIT;
SET bError = 'Y';
END;

on occassion i get an error and when the handler tries to do the rollback the savepoint does not exist. is there a way to check if the savepoint exists? or is there a way to just have the handler go to the next stmt if the rolback throws an error? kind of like on error resume next in vb

thanks for your time
Reply With Quote
  #2 (permalink)  
Old 07-19-10, 08:49
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
If the savepoint does not exists in some instances, then you have a programming problem that need to be fixed.

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On