Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Returning SQL.SQLCODE from SQLPLUS
We could use your help with a problem in SQLPLUS/PL/SQL
PROBLEM:
Our group runs SQLPLUS (plus33.exe) under Windows NT. When we attempt to
interrogate the error codes returned from SQLPLUS (using EXIT SQL.SQLCODE) our
command shell (we use MKS Toolkit's KSH) always converts the return value to
something else. I think that SQLPLUS is returning a negative number or
something then MKS Toolkit is interpreting it incorrectly, and therefore EXIT
SQL.SQLCODE is essentially useless to us.
OUR ATTEMPT TO RESOLVE
We thought that if we could do something like convert SQL.SQLCODE to the
Absolute value of SQL.SQLCODE then we could return a variable containing the
real error value as a positive integer. This would at least be useful to a
calling batch job so it could act on the results.
OUR FINDINGS By creating a binding SQLPLUS variable (VARIABLE x NUMBER) we attempt to assing SQL.SQLCODE to this variable x, but it seems that we always reset the SQL.SQLCODE value back to a non-error state (because that statement completed successfully, of course). For example:
Variable I Number;
Exec :X := ABS(SQL.SQLCODE);
Exit X
This always returns 0.
If you know of a way that we can capture SQL.SQLCODE for the purpose of returning as a non-negative number, we sure could use your help.
Thanks for reading.
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Sep 11 1998 - 15:56:06 CDT