The magic of ksh. You can just embed you sqlplus command inside some forward quotes and bingo, your variable is set.
#!/bin/ksh
THE_VALUE=`sqlplus -s system/manager <<EOF
set feedback off
set echo off
set pages 0
DECLARE
RetVal NUMBER;
BEGIN
dbms_output.put_line(ODSLOAD.FUNC_EXTRACT_TRAILER ( 1 ));
END;
EOF
`
echo $THE_VALUE
# end of ksh
This way, you can check the value of $? to see of the sqlplus command was successful and also get your value back.
Bookmarks