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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to return an value from Oracle to Unix in a shell scrtip.

Re: How to return an value from Oracle to Unix in a shell scrtip.

From: Avi Abrami <aabrami_at_intersystemsww.com>
Date: Mon, 23 Oct 2000 17:38:09 +0200
Message-ID: <39F45B61.B4B6FAF5@intersystemsww.com>

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

Original text of this message

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