Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Return Exit value to a unix shell script

Re: Return Exit value to a unix shell script

From: Igor A. Feoktistov <fia_at_ins.dn.ua>
Date: 22 Dec 1999 13:53:56 +0200
Message-ID: <83qe4k$l9m$1@dream.ins.dn.ua>


Marc Weinsock <MWeinstock_at_lds.com> wrote:
> Does anyone know how the get sqlplus to return a exit value to a shell
> script? When I run the following script my "exit val" statement does
> not work. Is there a fix for this one?
If I were you I would try next shell code:

#!/bin/sh

var=`echo "select 'Result of my func' result, my_func from dual; exit" |
sqlplus $ORAUSER/$ORAPASS@$ORAHOST |
sed -n 's/^Result of my func//p' |
while read result
do

   echo ${result}
done`
if [ $var != "1" ]
then

    echo DO SOMETHING
fi
if [ $var != "2" ]
then

    echo DO SOMETHING ELSE
fi

> #!/bin/sh

> sqlplus $ORAUSER/$ORAPASS@$ORAHOST << EOF
> VARIABLE val number;
> begin
> select my_func into :val from dual;
> //my_func will return 1 or 2
> end;
> /
> exit val
> EOF

> if [ $? != "1" ]
> then
> echo DO SOMETHING
> fi
> }
> if [ $? != "2" ]
> then
> echo DO SOMETHING ELSE
> fi
> }

> --
> ===============================================
> Marc Weinstock
> Logical design Solutions

> 55 Broadway - 21st Floor
> New York, New York 10006

> Phone: 800.221.5327 x2136
> Fax: 212-825-2245
> E-Mail: MWeinstock_at_lds.com
> Web: http://www.lds.com

-- 
----------------------------
E-mail: fia_at_ins.dn.ua

ICQ: 34433616 Received on Wed Dec 22 1999 - 05:53:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US