akelabanda
Programmer
Hi There
I'm running an sql query from within a shell script.
We use a different exit code to denote SUCCESS (99) rather than 0.
The code is something like this (assuming only 1 row is returned) -
-------------------------------------
temp_percent="set pages 0
set head off
whenever sqlerror exit sql.sqlcode;
select name from Test_table where age=100;
/
exit 99"
age=$(print "${temp_percent}"|sqlplus -s scott/tiger@testdb)
-------------------------------------
My problem is when 'age' gets assigned with the value from the query, the shell would return zero for $? rather than the sql exit code.
Is there a way to get both the result and the exit code from the sql query into the shell script.
Many thanks in advance for your responses.
Rajeev
UK's best mobile deals online
I'm running an sql query from within a shell script.
We use a different exit code to denote SUCCESS (99) rather than 0.
The code is something like this (assuming only 1 row is returned) -
-------------------------------------
temp_percent="set pages 0
set head off
whenever sqlerror exit sql.sqlcode;
select name from Test_table where age=100;
/
exit 99"
age=$(print "${temp_percent}"|sqlplus -s scott/tiger@testdb)
-------------------------------------
My problem is when 'age' gets assigned with the value from the query, the shell would return zero for $? rather than the sql exit code.
Is there a way to get both the result and the exit code from the sql query into the shell script.
Many thanks in advance for your responses.
Rajeev
UK's best mobile deals online