Showing results for 
Search instead for 
Did you mean: 

problem executing sql script

Cathy Arora
Frequent Advisor

problem executing sql script

I am having problrm running script in sqlplus on unix 11:00 box
as an example
I have simple script saved in my home/scripts called whoami
ams i tried running at sqlplus probpt after logging in and got following error
I change the permission on the script as well.
SQL> @whoami
SP2-0310: unable to open file "whoami.sql"

Help is appreciated.
Graham Cameron_1
Honored Contributor

Re: problem executing sql script


SQLplus will look for scripts in your current directory, then in the directory pointed to by $SQLPATH, if set.
Extension should be .sql

It evidently can't find whoami.sql in either of these.

Did you cd into home/scripts before firing up sqlplus ?

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
David Andrews_1

Re: problem executing sql script


As Graham has correctly stated sqlplus looks for sql scripts with an extension of .sql

It automatically assumes that there is an extension of .sql on the file, if another extension has not been stated.

If your script is in /home/scripts
and is called whoami

First rename the script whoami to whoami.sql

Then, from a SQL> prompt type either




They equate to the same thing.