I am using the following simple UNIX script to assign the output to a variable.
count=`sqlplus -s ${DB_USER}/${DB_PASS}@${DB_INST} << END
SELECT COUNT(column_name) from table_name;
END`
echo $count
But I am getting the following error on executing:
SP2-0042: unknown command "END" - rest of line ignored.
count=`sqlplus -s ${DB_USER}/${DB_PASS}@${DB_INST} << END
When I tried to execute the above statement in putty, it was saying as "bad substitution"
So I am using UNIX script to assign the output to a variable.
count=sqlplus DB_USER/DB_PASS << END
SELECT VERSION_NUMBER from GA_PERIODIC_REFRESH where MODULE_NAME in 'RoaminfoService';
exit;
END
echo $count