DB connection and query

Hi

I'm trying to create a connection with DB from shell script using the following string

sqlplus <user>@<db_instance>/<password>

in which I'm successful.

However, after connecting to DB it is giving me a sql prompt as follows

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

SQL>

But I want to run a select query on DB and to save that output into some variable so that I can use that variable some where in my shell script.

or Can I pull the value from DB and store in some variable without going to the sql prompt ?

Can anybody help me out for this?

I'll appreciate your help.

Regards,
Sumit Saini

Hi

Check the examples here: how to connect to sqlplus and retrieve data in shell

Guru.

Thanks a lot Guru.:b: