Page 1 of 1

Error Flag

Posted: Mon Aug 09, 2010 7:49 am
by gaurav.shetti
Just a small question.
I have a pro*C which takes in a dynamic query and connects to oracle, fetches the data and then prints the o/p
When an error is detected these are the lines of code there
EXEC SQL WHENEVER SQLERROR CONTINUE;

printf("\nORACLE error detected:");
printf("\n% .70s \n", sqlca.sqlerrm.sqlerrmc);

EXEC SQL ROLLBACK WORK RELEASE;
exit(EXIT_FAILURE);


There is a vortex script which calls this pro*C

Now when i give in a wrong query ... (the table doesnt exist, i gave in the wrong table name), and then pass it to this pro*C from vortex script

The Err flag is not set
Instead $ret.oerr is set as "118 <EXEC> command sh returned exit code 1"

My question is .. why isnt the error flag $err and $errnum not being set here.

Isnt this an error?

Error Flag

Posted: Mon Aug 09, 2010 10:20 am
by mark
For <exec> use $ret.exitcode to get the program's exit code.

$errnum is only set within <putmsg>. I'm not sure where you got $err.

Error Flag

Posted: Mon Aug 09, 2010 10:41 am
by gaurav.shetti
Yeah that was the question .. I dont get $err set. Maybe you are right
But then what are the different values of $ret.exitcode that will tell me whether it was a success or a failure or just a warning.

Error Flag

Posted: Mon Aug 09, 2010 10:57 am
by mark
$ret.exitcode is what your execed program sets. See the code or documentation of that program to know what the different values mean.

Error Flag

Posted: Mon Aug 09, 2010 11:10 am
by John
I.e. $ret.exitcode should correspond to EXIT_FAILURE from the call to exit() in pro*C, which from the message looks like it is 1.