Want to use the output of Select statement in Unix script

Hi,
I have a UNIX script which calls SQL Select statement:

Now i want to use the output of that select statement within my UNIX script so as to call different shell script depending upon the output of the select statement.

Can anyone help me in this regard.

TIA

Akhil Goel

Yes.....

.....if you post the contents of the script that you're using.

Cheers
ZB

Please have a look on the below example so as to let you know what exactly i need...

Shell Script:

echo " You are in shell script"

# Start of SQL

     str=\`sqlplus sa/sa <<eof!
     set verify off
     set heading off
     set feedback off
     Select * from table_case;
      exit
      eof!
         \`

# End of SQL

i would like to have the output of the above SQL query here..
# display result of above query
echo ???

i dont want to use stored proc

Also see if the below example is possible: can the variable of shell scripts (e.g. count) be accessible in SQL block, If yes then how?

Shell Script:

read count

# Start of SQL

str=`sqlplus sa/sa <<eof!
set verify off
set heading off
set feedback off
Select * from table_case where id = $count;
exit
eof!
`
# End of SQL

If you want to send values to a SQL script as a command line parameter then call your sqlplus command with arguments as follows

sqlplus username/password argument1 argument2 ..

and within the sqlplus commands refer to the arguments as positional parameters as &1, &2 ..

Also if you want to send values from the sql scripts back into the calling environment you would have to write PL/SQL blocks coded into sql scripts which can communicate values from the sqlplus exeuctions as bind_variables. Then you can use the exit command as follows within the PL/SQL block and pass the bind variable back to the calling environment.

EXIT :BIND_VAR;

Jerardfjay