hi
I have a sqlstatement that returns a lot of rows from sqlplus, and I need to go throu them row by row.
I can do this by spooling them to a file and then reading the file row by row, but I would rather not put them into a file. And do it by a variable.
This is the sql that I and working from.
this puts the result into the variable a. And i can go throu this one , but not row by row (as far as I know.)
One of the ideers i have if I could get the SQL to put a devider between the results, putting every row into one.
Does anybody know how i in sqlplus puts a devider between the colums.
Or perhaps even better, knows a smarter way to handle sqlplus output in from rows.
Regards
LHG
I have a sqlstatement that returns a lot of rows from sqlplus, and I need to go throu them row by row.
I can do this by spooling them to a file and then reading the file row by row, but I would rather not put them into a file. And do it by a variable.
This is the sql that I and working from.
Code:
a=`sqlplus -silent sndappsco/barney@p01sc1 << EOF
set linesize 132
set pagesize 999
set head off
set feed off
SELECT phd_id,(SELECT COUNT(*) FROM q3 WHERE dvc_trx_sts_cd='PE' AND phd_id=A.phd_id) Count
FROM phd_port_info A
GROUP BY phd_id;
EOF`
for i in $a
do
echo $i
done
this puts the result into the variable a. And i can go throu this one , but not row by row (as far as I know.)
One of the ideers i have if I could get the SQL to put a devider between the results, putting every row into one.
Does anybody know how i in sqlplus puts a devider between the colums.
Or perhaps even better, knows a smarter way to handle sqlplus output in from rows.
Regards
LHG