Link to home
Start Free TrialLog in
Avatar of jnowlin
jnowlin

asked on

Starting SQL+ Scripts from Anywhere

Hello.

Is there a way to run a SQL script file
from anywhere, no matter what directory/folder it's located? In the old DOS days (and to some extent, Windows) you had a path statement in the AUTOEXEC.BAT file, or you could set the PATH environment with SET PATH=....

Does Oracle provide a similar method to do this? i.e. Perhaps  directories/folders off of the BIN directory/folder would enable one to run
the program using only:

SQL>start filename.sql

instead of typing the full path to the file each and every time. Or, perhaps one could have a script named go.sql which would accept a filename as its argument.

Any suggestions?

Jim
ASKER CERTIFIED SOLUTION
Avatar of ivenkys_1
ivenkys_1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mshaikh
mshaikh

If you start SQLPLUS from the directory where the scripts are located then you don't have to specify the path. It will first look in the directory from which SQLPLUS was started. If your scripts are in C:\MYSCRIPTS then do the following:

C:
cd C:\MYSCRIPTS
sqlplus



Now, if filename.sql is in C:\MYSCRIPTS you could type:
SQL>start filename.sql
Go to your registry and set the value:
ORACLE_PATH to the path you want Oracle to search when looking for your script.
I have another suggestion.
By the way, all answers to all your questions can be easily found in the docs on your CD.
Avatar of jnowlin

ASKER

Mr. Gokman, you are a DBA. I regret that the local library didn't have your book on hand. It must surely be very helpful and informative.

Our instructor told us that
DBAs are like God and that we should get to know very well these people, stay on there good side. Any suggestions along these lines sir?

Jim Nowlin
Princeton, MA   U.S.A.