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: SQL*PLUS - how run scripts?

Re: SQL*PLUS - how run scripts?

From: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Wed, 06 Aug 2003 16:43:38 GMT
Message-ID: <MPG.199ad0114585722c98982a@news.la.sbcglobal.net>


Hi Randy Nichols, thanks for writing this:
> There is something that should be simple but I cannot find how to do it.
>
> In SQL*PLUS, the "@" command runs scripts. But you have to know the path
> (unless it is in certain directories).
>
> The "File | Open" function allows you to browse for a file, but "opening" a
> file is different from running it. (My impression is that you can only open
> a file with a single command in it, whereas you can run scripts with many
> commands in it, including SQL*PLUS commands and PL/SQL blocks.)
>
> How do you browse to a script file to run it in SQL*PLUS?
>
> Thanks,
>
> Randy Nichols
>

If you set the SQLPATH variable (environment variable most places; registry for Win), you don't need the path (or can use a relative path from one of the paths specified in SQLPATH). This means you have to keep most of your SQL scripts in common directories.

You can File / Open a script containing many commands, but it won't run (correctly). You can use this to set your current directory to where you keep all your scripts (open any script, ctrl-c, then use "@" to run any script in that directory). This is also useful if you spool your output to a file, then host out to DOS (so you don't end up spooling everything to the "bin" directory).

If you use a double-ampersand ("@@"), it means run the script in the current directory (in case you have another script by the same name in a different directory).

-- 
[:%s/Karsten Farrell/Oracle DBA/g]
Received on Wed Aug 06 2003 - 11:43:38 CDT

Original text of this message

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