Operating System - Linux
1754054 Members
3098 Online
108811 Solutions
New Discussion юеВ

Re: shell and sql scripts

 
SOLVED
Go to solution
Shivkumar
Super Advisor

shell and sql scripts

Dear Sirs,

How can I pass back the status from sql script to shell script ?

Thanks,
Shiv
2 REPLIES 2
Sandman!
Honored Contributor
Solution

Re: shell and sql scripts

Shiv,

Assuming you will be running sql commands within sqlplus, which has an "exit" command that will return a status to the calling environment (be it the command line or a shell script). For example:

=================shellscript===================
#!/usr/bin/sh

sqlplus -s user/pass@dbname <.
.
.
exit
EOF

echo $?
=============================================

cheers!
Arunvijai_4
Honored Contributor

Re: shell and sql scripts

Hi Shiv, You can easily get to know by shell's default variable "$?" from any shell. If you are using a shell script, just get the value by # echo $?

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"