Home » Developer & Programmer » Precompilers, OCI & OCCI » In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? (Pro*C, 10.2.0.2.0, AIX)
In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678941] Thu, 23 January 2020 03:49 Go to next message
NevemTeve
Messages: 25
Registered: November 2017
Junior Member
Hi, this is a bad question; I know it can, as I just got sqlca.sqlcode=1403 when zero line matched the WHERE condition of an UPDATE.

With Sql*Plus I get the expected result: "0 rows updated"

So my only question: is this behavior of Pro*C documented?
Re: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678944 is a reply to message #678941] Thu, 23 January 2020 10:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Can you post the code you use (or a test case giving the same issue) and the compilation option you use (including the configuration file(s)).

Re: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678946 is a reply to message #678941] Thu, 23 January 2020 10:34 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
NevemTeve wrote on Thu, 23 January 2020 03:49
Hi, this is a bad question; I know it can, as I just got sqlca.sqlcode=1403 when zero line matched the WHERE condition of an UPDATE.

With Sql*Plus I get the expected result: "0 rows updated"

So my only question: is this behavior of Pro*C documented?
Is what behavior documented? The guy that wrote sqlplus coded to send the string '0 rows updated' to stdout when it detects sqlca.sqlcode=1403. Now you are writing your own program, so you have to decide for yourself what you want your program to do when it detects various sqlcodes.
Re: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678947 is a reply to message #678944] Thu, 23 January 2020 10:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quoted from doc:

Quote:
SQLCODE has a value of +1403 (+100 when MODE=ANSI) because Oracle could not find a row that meets your WHERE-clause search condition, or a SELECT INTO or FETCH returned no rows.

So, as soon as you have a WHERE clause which matches with no rows, sqlcode is set to 1403.

Re: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678948 is a reply to message #678946] Thu, 23 January 2020 10:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
The guy that wrote sqlplus coded to send the string '0 rows updated' to stdout when it detects sqlca.sqlcode=1403.
I think the guy just check the equivalent of Pro*C "sqlca.sqlerrd[2]" (number of rows processed) without checking (the equivalent of) "sqlca.sqlcode" when it is not negative (SQL*Plus is not written with Pro*C).

Re: In Pro*C, can UPDATE return sqlca.sqlcode=1403 ? [message #678950 is a reply to message #678948] Thu, 23 January 2020 11:27 Go to previous message
NevemTeve
Messages: 25
Registered: November 2017
Junior Member
Hi guys, thank you for you help,

I sort of know what 'not found' means when I execute a `SELECT INTO` or `FETCH INTO`; but it did surprise me that a successful update (that happened to affect zero lines) why should return 'not found' instead of 'ok'.

Anyways, it just does that, so I think I'll deal with it.

Again: thank you guys.
Previous Topic: Not able to compile simple OCI program on linux
Next Topic: error in C++ and occi call and Errors in OCCI header files.
Goto Forum:
  


Current Time: Thu Mar 28 09:44:57 CDT 2024