Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Lima-Peru
    Posts
    7

    Lightbulb Unanswered: 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.

  2. #2
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •