Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sqlplus output ...

Re: Sqlplus output ...

From: Kumar, Sai (EXCHANGE:PERPK:3374) <saikumar_at_nortel.com>
Date: Thu, 17 Dec 1998 09:16:09 -0500
Message-ID: <36791229.67AC5F78@nortel.com>


Marc-Olivier BLANC wrote:

> Hello,
>
> I want to launch sqlplus commands via a shell
> script and then get back the results and put them
> in a text file with a special format. Can someone
> tell me how to launch sql commands and get the
> output ?
>
> Thanks.

Marc,

Here is a sample shell script :-

check your login environment variables if it has all the default oracle parameters set up, for eg;- oracle_sid,oracle_home,oracle_base.

#!/bin/ksh

export ORACLE_SID=DEVP
sqlplus -s scott/tiger @test.sql

On the test.sql script do the following :-

set verify off
set feedback off
spool test.lst
select * from table_name;
spool off
exit

Run the ksh script and it will generate an output file called test.lst

Thanks
Sai Received on Thu Dec 17 1998 - 08:16:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US