I have been running a function in Oracle that works fine. When I try to extract the return code to a variable called num in UNIX the variable never gets set to the return code from Oracle. The code I am using is below. I welcome any ideas or comments. Thanks

typeset num



export ORACLE_SID=CBTST

num=`sqlplus -s << EOSQL
${FMGDBUSER}/${FMGDBPASSWD}
set serveroutput on
declare
x number;
begin
x := UPD_FUNC(000046,'E');
dbms_output.put_line(x);
end;
EOSQL
`
echo num=$num
return 0