Starting SQL+ Scripts from Anywhere


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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim wat u cld possibly do is
write ur script into a file called as login.sql.
it loads everytime u startup sqlplus.
also chek the registry entry for oracle it shld b able to provide the oracle path settings in it.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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:


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.
jnowlinAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.