• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1637
  • Last Modified:

setting command path of sqlplus

Experts,
I created a .sql (showtables.sql) at C:\oraclexe\command. Well, if I start sqlplus from that directory and run @showtables It fine...
But, one problem is comming..... How could I set command path of sqlplus, so that I could run @showtables by sqlplus from anydirectory?
Please have a look of code snippet...

note : if anyone could give me fully detail what should I do.... I must given max points on the question.
C:\oraclexe\command>sqlplus test/test007
SQL> @showtables;
 
OWNER      TABLE_NAME
---------- --------------------
TEST       TEST2_SQL
TEST       TEST22
TEST       TESTDATE
TEST       T1
TEST       TEST_NUMBERS
TEST       CUSTOMERS
TEST       TEST
TEST       GROUPS
TEST       PRODUCTS
TEST       T
 
 
 
C:\>sqlplus test/test007
SQL> @showtables;
SP2-0310: !Õ‹_”H "showtables.sql"

Open in new window

0
fsze88
Asked:
fsze88
1 Solution
 
crawforditsCommented:
@C:\oraclexe\command\showtables.sql
0
 
fsze88Author Commented:
no, I would like to just run @showtables by sqlplus from any directory (path)
file at C:\oraclexe\command>
but run it from c:\
C:\>sqlplus test/test007
SQL> @showtables;
possible?
0
 
johnsoneSenior Oracle DBACommented:
There is an environment variable SQLPATH that controls where SQL*Plus looks for scripts.
0
 
fsze88Author Commented:
Yes, that's what I am looking for, thanks
0
 
sugarfreelessCommented:
Well if you run the sqlplus command in a command prompt then you can run it from anywhere.  I tell you how to do this below.

Unfortunately you can't set a path enviornment in sqlplus.  But for some other sqlplus environment settings look here: http://www.orafaq.com/wiki/SQL*Plus_FAQ

Right click on my computer, go to advanced tab.
click environment variables button and new.

type in showtables for variable name
type in full path to showtables in variable value, and use quotes if there is any odd characters.
IE: "C:\oraclexe\command\showtables.sql"
click ok

open a command prompt and type sqlplus "test/test007" @showtables [ENTER]
and it should run just fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now