I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to store output for above query by running sql command script only once
sql_output=`sqlplus -S <<-EOSQL
$my_db_userid
$my_db_password
select 'query 1' from dual ;
select 'query 2' from dual ;
EOSQL`
I've not checked this, but it is pretty close, I think. The commands to be input to sqlplus as though it was an interactive session are between the two EOSQL markers.