Re: exit status of sqlplus???

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/02/19
Message-ID: <5eescs$e5q_at_camelot.dsccc.com>#1/1


#       /***********************************************************************#       *
#       *       a korn shell script to login to oracle to see if it is up.
#       *
#       *       The 6 "set pause off" are to get you through the
#       *       request for id and passwords if the id/passwd is invalid.
#       *
#       *       If you connect to oracle, a 5 will be returned as a status
#       *       value at the shell.
#       *
#       *       The <<'EOF' tells the shell to feed the following lines to 
#       *       sqlplus until the shell finds the string 'EOF'
#       *
#       ***********************************************************************/
sqlplus <<'EOF'
id/passwd
set pause off
set pause off
set pause off
set pause off
set pause off
set pause off
exit 5
EOF   if [ $? != 5 ] ; then
  echo "It did not work"
  return
fi  

Wang Chun (wangchun_at_iti.gov.sg) wrote:
: Hi,
 

: I tried to run a sql script using sqlplus, however, I could not figure out
: how to check the exit status at the unix shell level of a certain sql script
: to see whether the sql script is successful or failure.
 

: for example:
 

: shell>sqlplus _at_my_sql_script
 

: ...
 

: shell> (as when sqlplus exits, it always give me the exit code 0)
 

: Any suggestion?
 

: Thanks in advance!

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Wed Feb 19 1997 - 00:00:00 CET

Original text of this message