In ECPG, there are instances when I'm not concerned about the error/warning
generated by a piece of SQL. In those instances I'm using EXEC SQL WHENEVER
ERROR CONTINUE; However as I understand it, the sqlca structure which holds
the warnings and errors, remains populated, so that when I do check for an
error after a subsequent SQL command, even if that command DID NOT fail,
POSTGRES will still report an error from the previous SQL command which did
and for which I did a CONTINUE.
My question is, is there a simple way to reset the sqlca structure after
doing a CONTINUE?
EXEC SQL DROP INDEX index1;
EXEC SQL WHENEVER ERROR CONTINUE; /* Don't care about the error, just
EXEC SQL SELECT col1 FROM table1 WHERE col2 = :acString;
if (strncmp(sqlca.sqlstate, '00', 2) != 0)
/* Report error/warning here */
In the above example if the DROP INDEX errors or gives a warning, then even
if the SELECT works ok, the strncmp will still pick up the error from the
DROP INDEX, which is what I want to avoid. so how do I reset the sqlca
structure after the DROP INDEX command?
Finally if the DROP INDEX gives a warning do I need to explicity check for
that with an EXEC SQL WHENEVER WARNING CONTINUE, or will the WHENEVER ERROR
pick that up as well?
I hope all that makes sense.
pgsql-novice by date
|Next:||From: Atif Jung||Date: 2010-06-24 14:06:14|
|Subject: DECLARING & OPENING SURSORS|
|Previous:||From: Jean-Yves F. Barbier||Date: 2010-06-24 11:39:45|
|Subject: Re: RI|