Your SQL session will presumeable display the correct results to you, so what you need to do with the shell script is to read them in.
Are you expecting a single line with two values from your SQL or two lines?
If it is the latter, then after you EOF, try inserting the following:-
read l_out_put
read l_change_flag
This may hang if your shell decides it really wants to display the answers and then read input from the keyboard. Perhaps you need to change then end of your SQL block to read:-
print l_out_put
print l_change_flag
exit
EOF`|while read l_out_put
do
read l_change_flag
done
if [ $l_change_flag .........
Does that steer you towards a solution?
If not, can you run the SQL bit and paste the output from that and I'm sure someone will get it sorted.
I hope that this helps,
Robin
Liverpool/Blackburn
UK
Here's an example I did once to illustrate reading output from SQL/Plus and putting the data returned into shell variables. Maybe the general framework here will help you. This is ksh93 on Solaris:
#!/usr/dt/bin/dtksh
unset version
unset status
( sqlplus -s login/password@database <<EOF
set heading off;
select 'version='||'1.2' from dual;
select 'status='||'UP' from dual;
exit;
EOF
)|
while read line
do
if [[ -n $line ]]
then eval $line
fi
done
print "Version: $version"
print "Status: $status"
If indenting makes the code more readable, I have found that using a TAB characters to indent is acceptable to ksh, however spaces are a definite no-no.