#!/bin/ksh
##
## ksh to receive a value back from an SQL*Plus session
##
rtn_sql=`sqlplus -silent` << EOF
system/pwd
set pagesize 0 feedback off verify off heading off echo off
select count(*) from dual;
exit;
EOF
echo "$rtn_sql"
if [ $rtn_sql = 0 ]
then echo "No rows returned from database"
else echo "Nbr of rows $rtn_sql"
fi
#!/bin/ksh
##
## ksh to receive a value back from an SQL*Plus session
## from anonymous PL/SQL block using a bind variable
##
rtn_sql=`sqlplus -silent` << EOF
system/pwd
set pagesize 0 feedback off verify off heading off echo off
VARIABLE rtnvalue number;
begin
:rtnvalue:=0;
end;
/
print rtnvalue;
exit;
EOF
echo "$rtn_sql"
#!/bin/ksh
##
## ksh to receive a value back from an SQL*Plus session
## using the exit status code (integer values only)
##
#!/bin/ksh
sqlplus -s > test.log "/nolog" <
|