SQL*Plus and PL/SQL

From: Anil Sukul <anils_at_atf.cmg.nl>
Date: 1998/02/12
Message-ID: <Eo9p7J.L7o_at_atf.cmg.nl>#1/1


Is there a possibility to return a variable (not a bind variable) in a PL/SQL block to SQL*Plus?

More specific: I want to return an exit status from SQL*Plus to my OS (i.c. UNIX), where the value of the exit status is determined by a PL/SQL block.

My question: is it possible to use a non-bind-variable in PL/SQL whose value can be accessed by the enclosing SQL*Plus statements?

So my SQL*Plus code would be like this:

cat > foo.sql << EOF

declare
begin

   return_status := 0; -- What should this be declared as??

   if error_condition then

        return_status := 1;
   end if;
end;
/

exit return_status;
EOF and my Unix script would be:

cat > scr << EOF
if sqlplus -s scott/tiger _at_foo
then

        echo ok
else

        echo not ok
fi
EOF          Thanx in advance,
Anil. Received on Thu Feb 12 1998 - 00:00:00 CET

Original text of this message