Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to return an value from Oracle to Unix in a shell scrtip.
gojo wrote:
> Hi there,
>
> I've a shell script that runs some Oracle procedures, what I would like
> to know is if the Oralce procedure was successful or had any error.
> Basically a flag that tells me everything is OKed, so I can do something
> else in the subsequent shell codes.
>
> Does anyone what are the methods to achieve that ?
>
> Thanks,
> Ken.
Hi Ken,
If I understand you correctly, you have a UNIX shell script
and in it you are calling SQL*Plus and executing some SQL
(or PL/SQL). If this is correct, and all you want to know is
whether the SQL succeeded, check the exit status. Example:
#!/bin/ksh
sqlplus / <<EOF
SELECT sysdate FROM dual;
EOF
if [ $? -ne 0 ]
then
echo "SQL Failed"
fi
Is that what you're looking for?
Avi.
Received on Mon Oct 23 2000 - 10:38:09 CDT
![]() |
![]() |