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 > exceptions in Informix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 13:37
amanriquem amanriquem is offline
Registered User
 
Join Date: Apr 2004
Location: Lima-Peru
Posts: 7
Lightbulb exceptions in Informix

hi, i'm new in informix, i would like to know how Informix holds exceptions, which global variables trap code and error message of the last sql error due to a sql sentence?

for example in Oracle we have:

sqlcode : last sqlcode due to an sql sentence
sqlerrm :last error message due to an sql sentence

thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 14:08
RobP RobP is offline
Registered User
 
Join Date: Mar 2004
Location: Netherlands
Posts: 183
Hi,

For this Informix uses the SQLCA (SQL Communication Area) record. This records has the following fields (and some more):

SQLCA.sqlcode = Error code of last SQL statement (0=OK)
SQLCA.sqlerrd = arrys of 6 elements, the most used elements are:
[2] : Last inserted serial value
[3] : Number of rows processed
[4] : Estimated CPU cost
[5] : Offset of error in SQL string
[6] : Rowid of last selected row

SQLCA.sqlwarn = string of 8 chars, every char one function
[1] : Blank, no warnings, W see rest of charcters for warning itself

You can query this for example by doing:
SELECT SQLCA.SQLERRD[3]
FROM systables
WHERE tabid = 1

Hope this helps,

Rob Prop
Reply With Quote
  #3 (permalink)  
Old 05-05-04, 12:52
amanriquem amanriquem is offline
Registered User
 
Join Date: Apr 2004
Location: Lima-Peru
Posts: 7
i found it

there is other way to obtain indicators about the sql sentence that ended in an error.


on excepcion set sqlcode, isamcode, sqlerrtext
....
end exception
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