Re: Reading return code PL/SQL from UNIX

From: Eugene Firyago <efiryago_at_bisys.com>
Date: 2000/04/11
Message-ID: <8cvdf8$k1q$1_at_bob.news.rcn.net>#1/1


Consider the following as an example:

CREATE OR REPLACE FUNCTION f RETURN NUMBER IS

    return_code NUMBER;
BEGIN
    ....

    return_code := <something>;
END f;

Then inside unix shell:

sqlplus -s username/password_at_database_service_name << EOI SET FEED OFF
VAR return_code NUMBER
BEGIN
        :return_code := f;
END;
/
EXIT :return_code
EOI SQLPLUSR=$?
if [ $SQLPLUSR = "0" ]
then

        ......
        exit 0
else
        ......
        exit 1

fi

Of course, you can use case instead of if...then as well.

Hope it helps,
Eugene.

Michetti Fabio <michettif_at_bpn.it> wrote in message news:8csc7e$t6f$1_at_fe1.cs.interbusiness.it...
> I’ve some PL/SQL programs, this programs runs in unix environment (inside
> shell). But when the first program is finished, if it is all OK then I can
> lunch the second program. If it is all OK then I can lunch then the third
> program.
>
> Can I read PL/SQL program return code in Unix environment inside shell
> procedure ?
> How ?
>
>
> Thanks very much.
>
>
>
Received on Tue Apr 11 2000 - 00:00:00 CEST

Original text of this message