I'm using KSH and calling a SQL statement inside my script which returns more than 1 record.
Result=`sqlplus -s $DB_USER/$DB_PWD@$DB_STRING <<END
set echo off
set head off
spool junk.txt
select Name from abc where job = 'Manager';
spool off
exit;
END`
echo $Result
The above SQL returns 3 names as:
But when i'm calling this SQL in my script and assigning the Result to a variable "Result" and echoing the same, the result comes out in a single line like below:
What I require is the output should be assigned to the variable result in the below format so that I can seggregate the records: