How to assign the result of a SQL command to more than one variable in shell script.

Hi Friends...

Please assist me to assign the result of a SQL query that results two column, to two variables.

Pls find the below code that I write for assigning one column to one variable. and please correct if anything wrong..

#! /bin/sh

no='

sqlplus -s uname/password@DBname <<EOF

set heading off
set feedback off

SELECT no from table_A where no=123;

exit

EOF`

--------------------------------------------------------------------

please help me, that I want to assign the result of below query to two variables 1.no and 2.name

select no,name from table_A where no=123

Thankyou for all of your answers!!

You better store the result in a single variable and then split it into peices n store , like below.

 
no='
sqlplus -s uname/password<<EOF
set heading off
set feedback off
SELECT no,name from table_A where no=123;
exit
EOF`
 
numb=`echo $no | awk '{print $1}'`
name=`echo $no | awk '{print $2}'`

You used a single quote instead of a backtick, is it a typo?
Anyway, search in the forum for query to variable, this question is asked frequently.

Thanks Panyam!!
It works for me..

Thanks its working 5n for me