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 > Informix > How to handle SQL RETURN CODE in SPL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-26-06, 10:57
upsingh upsingh is offline
Registered User
 
Join Date: Aug 2004
Posts: 10
How to handle SQL RETURN CODE in SPL

Hi,
New in informix,need help for
__________________________________________________ ___________
"How to handle the return code from query in informix SPL and TRACE the message of the SQLCODE and resume the control after that " .i have many SQL statements and want to do it for each .
__________________________________________________ ____________
Thanx & Regards
upsingh
Reply With Quote
  #2 (permalink)  
Old 04-28-06, 10:02
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,
Please read about ON EXCEPTION section and RAISE EXEPTION sintax.
Ex: RAISE EXCEPTION -746, 0, 'You broke the rules';

Gustavo.
Reply With Quote
  #3 (permalink)  
Old 05-05-06, 05:23
supinformix supinformix is offline
Registered User
 
Join Date: Apr 2004
Location: Brussels
Posts: 57
I had it open on another window,
make something like this,
and put it after your defines and before your instructions

ON EXCEPTION SET error_num, isam_num, error_msg
trace 'Error at label : ' || label ;
trace 'Error: ' || error_num || ' ' || error_msg;
return -1 ;
END EXCEPTION;

on exception in (-239) SET error_num, isam_num, error_msg -- if record already exists
trace 'Warning at label=' || label || ' ' || error_num || ' ' || error_msg;
trace 'Record already exists, key is ' || v_key ;
trace 'Continue with procedure';
end exception with resume;
Reply With Quote
  #4 (permalink)  
Old 05-05-06, 06:46
upsingh upsingh is offline
Registered User
 
Join Date: Aug 2004
Posts: 10
Smile Thanx ,its working

Thanx supinformix,
i am done with that and its working fine
ON EXCEPTION SET SQLERR,ISAMERR,ERRMSG
END EXCEPTION WITH RESUME
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