Hi,
I am reading two values from oracle to unix variable and spliting them using the read command as follows,
get_details=`sqlplus -s $sld_user/$sld_password@$sld_string<<EOF
whenever sqlerror exit 1
whenever oserror exit 1
set feedback off
set heading off
set pagesize 0
set echo off
set verify off
select one_value||'-'||second_value
from test_table
where processed_flag = 'N'
and error_flag = 'N'
and rownum < 2;
exit
EOF`
echo $get_details
IFS=-
read get_upload_id get_sold_to<<X
$get_details
X
echo $one_value
echo $second_value
Now this script is woking but when i try it another way as bellow,
get_details=`sqlplus -s $sld_user/$sld_password@$sld_string<<EOF
whenever sqlerror exit 1
whenever oserror exit 1
set feedback off
set heading off
set pagesize 0
set echo off
set verify off
select upload_id||'-'||sold_to_distr_code
from st_file_load_splitter
where processed_flag = 'N'
and error_flag = 'N'
and rownum < 2;
exit
EOF`
echo $get_details
if [ -z "$get_details" ];
then
echo ' No rows selected from database'
exit
else
echo 'now spliting the string'
IFS=-
read one_value second_value<<X
$get_details
X
echo $one_value
echo $second_value
fi
then i am getting the error saying
" syntax error at line XX: 'end of file' unexpected "
can any one please help me what is wrong with the second script.