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

Home -> Community -> Usenet -> c.d.o.server -> Re: Running an SQL script from C Shell (Unix)

Re: Running an SQL script from C Shell (Unix)

From: <oratune_at_aol.com>
Date: Mon, 02 Oct 2000 16:15:56 GMT
Message-ID: <8racbk$pqn$1@nnrp1.deja.com>

In article <8ra9ud$nju$1_at_nnrp1.deja.com>,   jpebejer_at_maltanet.net wrote:
>
>
> I have a script (myscript.sql) which I want to run AUTOMATICALLY each
> time from the shell through some sort of scripting (on a UNIX box).
>
> Aren't there some command line parameters to do this ?
> Say SQL*Plus myscript.sql ?
>
> Many Thanks
> JP
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

As long as your current environment points to $ORACLE_HOME and ORACLE_SID is set you should have no problem writing a short script to execute your SQL*Plus file. The following code should work:

sqlplus user/pass @myscript.sql

The "user/pass" parameter must be replaced with a valid Oracle username and password; if you want the script to execute and then return you to the shell prompt you will need to add an "exit" line at the bottom of your SQL*Plus script, otherwise you'll be at the SQL> prompt when the script finishes.

My C-shell is a bit rusty so I can't give you examples but it might be a nice addition to set a variable to your username/password values so you can change those in one spot if the password is ever modified or the Oracle account changes.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Oct 02 2000 - 11:15:56 CDT

Original text of this message

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