Unix Technical Forum

sqlca

This is a discussion on sqlca within the Informix forums, part of the Database Server Software category; --> i want to know the sqlca value in sqlca.sqlcode. for example we are checking sqlca.sqlcode < 0 is failure ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 05:28 PM
Trisha
 
Posts: n/a
Default sqlca

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 05:28 PM
Superboer
 
Posts: n/a
Default 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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 05:28 PM
Arthur V.Sidorenko
 
Posts: n/a
Default Re: sqlca


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
---------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 05:28 PM
scottishpoet
 
Posts: n/a
Default Re: sqlca

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/infoce...v111/index.jsp

and searching for sqlca we find

http://publib.boulder.ibm.com/infoce...6c%63%61%22%20

which hoepfulle tells you everything you need

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 05:28 PM
Art S. Kagel
 
Posts: n/a
Default Re: sqlca

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com