Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Return Exit value to a unix shell script
I think the only thing you have done
wrong here is to miss a colon:
exit :val
--
Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
Marc Weinsock wrote in message <385F9D10.999BF13E_at_lds.com>...
>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?
>
>#!/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
>
>
Received on Wed Dec 22 1999 - 09:05:22 CST
![]() |
![]() |