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: Run a script at the OS command prompt

Re: Run a script at the OS command prompt

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 03 Jul 2007 06:48:19 -0700
Message-ID: <1183470485.469894@bubbleator.drizzle.com>


Sashi wrote:
> All, I'm an sqlplus newbie and am trying to run a simple select at the
> operating system command prompt (and NOT the sqlplus command prompt).
>
> My command is like this:
> $bash-2.03> sqlplus user/password @/tmp/qry.sql >/tmp/out.sql
>
> Well, I have a select * from my_table in the qry.sql file. That's it.
>
> What I'd like to do is simply run this command and get the output
> captured into the out.sql file.
>
> When I examine the output, I see that each line of the output is
> preceded the column name (ugh) and I'm getting newlines before the
> record terminates.
>
> So:
> how do I specify an input and out file for running what I want to run?
> Exit sqlplus as soon as the query is done (for this I can probably
> simply put "exit" at the end of my qry.sql) script.
> For those who are familiar with isql in Sybase, the isql command has a
> -i and -o flags for the input and output files and runs the commands
> from the input files, stores the result in the output file and exits.
> TIA,
> Sashi

Go to Morgan's Library at www.psoug.org. Scroll down to UNIX/vi
Scroll down to SQL*Plus Shell Script Demo

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Tue Jul 03 2007 - 08:48:19 CDT

Original text of this message

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