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: Randy Nichols <randynichols_at_yahoo.com>
Date: Wed, 06 Aug 2003 23:06:39 GMT
Message-ID: <3SfYa.507$Ps.42821@newsread2.prod.itd.earthlink.net>


Thanks all for the answers.

Does it strike anyone else as a glaring omission that SQL*PLUS cannot browse to an arbitrary file and run it, yet it can browse to a file an open it? Aren't we talking a few lines of code to make SQL*PLUS a lot more friendly?

-Randy Nichols

"Anton Buijs" <remove_aammbuijs_at_xs4all.nl> wrote in message news:3f313f52$0$49103$e4fe514c_at_news.xs4all.nl...
>
> Karsten Farrell <kfarrell_at_belgariad.com> schreef in berichtnieuws
> MPG.199ad0114585722c98982a_at_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]
>
> May I precise this a bit.
> On Windows you set registry key HKLM\Software\Oracle\Home<n>\SQLPATH or a
> variable SQLPATH in a DOS box as a list of directories separated by a ";".
> On Unix the variable is called ORACLE_PATH.
> When you call a script (@x.sql) Sql*Plus will search these directories
and
> run it from the first directory where it is found.
>
> The @@ means that when @@y is a line in script x.sql than y.sql will
looked
> for in the same directory as where x.sql was found. When @@ is used not
from
> a another script file, @@ means the same as @.
>
>
>
Received on Wed Aug 06 2003 - 18:06:39 CDT

Original text of this message

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