Connecting DB in the Shell Script to do SQL Query

Any link or example to write shell script for the Connecting Oracle for Quering through SQL

thanks in advance ...

Cheers !!
Mehul Doshi

with sqlplus for oracle you can do:

shell>sqlplus username/password @filename_with_sql.sql

where filename_with_sql.sql looks like this for example:
------------------------------------------
select * from v$database;
quit
-------------------------------------------

/Peter

here is another way:

horiz=`sqlplus -s scott/tiger@test_db <<END
set pagesize 0
set feedback off
set heading off
set echo off
set verify off
select sysdate from dual;
exit;
END`

thanks for the help.

I would try this out and get back to you in case any more help or clarification required.

Cheers !!
Mehul Doshi