sqlca
Posted in 2007
Trisha asked what actual value ends up in sqlca.sqlcode when an SQL statement fails (is it -1, -2?) and how to find it out. Replies explained that sqlcode is 0 on success, 100 for not-found/end-of-data, and a specific negative Informix error number on failure; the exact meaning can be looked up with the finderr utility, the Error Messages manual, or the online IDS Information Center. Art Kagel added that applications should also report sqlca.sqlerrd[1] (the underlying ISAM/RSAM error), sqlca.sqlerrm (message parameter, useful for constraint/unique-key violations) and sqlca.sqlerrd[4] (syntax-error position for -201). Question answered.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Error Codes & Troubleshooting
i want to know the sqlca value in sqlca.sqlcode. for example we are checking sqlca.sqlcode < 0 is failure of sql statement. what is the value stored in sqlca.sqlcode is it -1 or -2 how to find out that value? regards trusha
finderr err_number or RTFM Informix Error Messages Book or http://www.oninit.com/errorcode/index.php You must remember that there are one possitive error - notfound = 100 > i want to know the sqlca value in sqlca.sqlcode. > > for example we are checking sqlca.sqlcode < 0 is failure of sql > statement. > > what is the value stored in sqlca.sqlcode is it -1 or -2 > how to find out that value? -- --------------------- Arthur V.Sidorenko Phone: +7 095 9950031, (TU)219 www.komus.ru ---------------------
This is well doced somewhere.
the value of sqlca.sqlcode is an error number representing the error
encountered.
see the error message manual.
finderr <errno> gives also the description.
examples...:
$ finderr -245-245 Could not position within a file via an index.
The database server encountered an error when it attempted to look up
a
row through an index. Check the accompanying ISAM error code for more
information. The table file or the index file might have been
corrupted. Unless the ISAM error code or an operating-system message
points to another cause, run the oncheck utility (secheck with IBM
Informix
SE or tbcheck with IBM Informix OnLine) to check and repair table and
index.
$ finderr -692-692 Key value for constraint constraint-name is still being
referenced.
You have violated a referential constraint. This situation usually
occurs when you are trying to delete a row in a column (parent key)
that another row (child key) is referencing. If you are using
cascading
deletes, database logging must be on.
etc.
btw notfound is 100
Superboer
On 17 okt, 08:16, Trisha <informixt...@hotmail.com> wrote:
> i want to know the sqlca value in sqlca.sqlcode.
>
> for example we are checking sqlca.sqlcode < 0 is failure of sql
> statement.
>
> what is the value stored in sqlca.sqlcode is it -1 or -2
> how to find out that value?
>
> regards
> trusha
I would have thought that by now people would be using the searchable index
on the manuals to get this info. How about searching for either SQLCODE or
SQLCA. Both would find the answer.
Regards
Malcolm
-----Original Message-----
From: informix-list-bounces@iiug.org [mailto:informix-list-bounces@iiug.org]
On Behalf Of Superboer
Sent: 17 October 2007 07:40
To: informix-list@iiug.org
Subject: Re: sqlca
This is well doced somewhere.
the value of sqlca.sqlcode is an error number representing the error
encountered.
see the error message manual.
finderr <errno> gives also the description.
examples...:
$ finderr -245-245 Could not position within a file via an index.
The database server encountered an error when it attempted to look up
a
row through an index. Check the accompanying ISAM error code for more
information. The table file or the index file might have been
corrupted. Unless the ISAM error code or an operating-system message
points to another cause, run the oncheck utility (secheck with IBM
Informix
SE or tbcheck with IBM Informix OnLine) to check and repair table and
index.
$ finderr -692-692 Key value for constraint constraint-name is still being
referenced.
You have violated a referential constraint. This situation usually
occurs when you are trying to delete a row in a column (parent key)
that another row (child key) is referencing. If you are using
cascading
deletes, database logging must be on.
etc.
btw notfound is 100
Superboer
On 17 okt, 08:16, Trisha <informixt...@hotmail.com> wrote:
> i want to know the sqlca value in sqlca.sqlcode.
>
> for example we are checking sqlca.sqlcode < 0 is failure of sql
> statement.
>
> what is the value stored in sqlca.sqlcode is it -1 or -2
> how to find out that value?
>
> regards
> trusha
_______________________________________________
Informix-list mailing list
Informix-list@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list
On Oct 17, 7:16 am, Trisha <informixt...@hotmail.com> wrote: > i want to know the sqlca value in sqlca.sqlcode. > > for example we are checking sqlca.sqlcode < 0 is failure of sql > statement. > > what is the value stored in sqlca.sqlcode is it -1 or -2 > how to find out that value? > > regards > trusha All the info you need should be in the online docs looking at the IDS tech info centre http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp and searching for sqlca we find http://publib.boulder.ibm.com/infocenter/idshelp/v111/topic/com.ibm.esqlc.doc/esqlc216.htm?resultof=%22%73%71%6c%63%61%22%20 which hoepfulle tells you everything you need
On Oct 17, 2:16 am, Trisha <informixt...@hotmail.com> wrote: > i want to know the sqlca value in sqlca.sqlcode. > > for example we are checking sqlca.sqlcode < 0 is failure of sql > statement. > > what is the value stored in sqlca.sqlcode is it -1 or -2 > how to find out that value? Trisha, take the other posts also, but I think what you asked is: "We're testing for sqlca.sqlcode < 0, but what is the actual value in there?" If so, the answer is: It depends on what the error was. On success, sqlca.sqlcode contains either zero or positive 100 (meaining data not found or no more data). On error it contains some negative integer the exact value of which you can look up, as suggested, using the finderr commandline utility or the Informix Error Messages manual to determine the exact error. The sqlca.sqlcode contains only the SQL level error, however, you must also look at the value of sqlca.sqlerrd[1] if sqlca.sqlcode is < 0 to determine the lower level library or RSAM error. Often the SQL level error is 'Could not position withing table' (see finderr -243) which is not very helpful, but the RSAM error that accompanies it may clarify by specifying an index key was locked or a table row was locked during a sequential scan, or the engine detected that this query would deadlock with another (see finderr -143) and so rejected it. You should modify your applications to print out both the sqlca.sqlcode and the sqlca.sqlerrd[1]. For certain errors (like constraint violations and unique key clashes) it will help to also print the errror message parameter - sqlca.sqlerrm which can help track down the cause of a rejected insert or update. On PREPARE and EXECUTE statements it is sometimes helpful to print sqlca.sqlerrd[4] which is the position of a syntax error (sqlca.sqlcode == -201) withing the SQL string. Art S. Kagel