Home » Infrastructure » Windows » Changing the current directory while running an SQL script (Oracle 10.2.0.3.0)
Changing the current directory while running an SQL script [message #278272] Fri, 02 November 2007 11:14 Go to next message
arsavad
Messages: 2
Registered: November 2007
Junior Member
Hi Friends

Can you plz help me to solve following 2 scenarios

1.Accoding to a requirement, I have to change the directory of the
commandprompt during the execution of an SQL script
Explanation:-
Suppose I strted my SQL script at D:/..After some scripts were run,
without exiting from SQL prompt, I have to go to
D:/Airline/JetAirways and then continuing execution of SQL scripts from
there

2.I have to accept some parameters for an SQL file from a .BAT script

Explanation:-

Suppose I want to do expdp automatically, for that I want to store the
schema details to par file after accepting
from bat script..Also if possible I would like to have prompt of
schemaname at the DOS prompt
as like in SQLPLUS while using '&&' operator..
Re: Changing the current directory while running an SQL script [message #278718 is a reply to message #278272] Mon, 05 November 2007 08:24 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
You can execute OS level commands by using $Command.

 SQL> $cd c:\
Re: Changing the current directory while running an SQL script [message #278772 is a reply to message #278718] Mon, 05 November 2007 11:39 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, you can ... but, as far as I can tell, that's not the answer. See an example - I'm connecting from the root (c:\):
C:\>sqlplus scott/tiger

SQL> $dir *.sql
 Volume in drive C has no label.
 Volume Serial Number is B0C4-68EB

 Directory of C:\                                     --> note this!

05.06.2007  21:35                54 test.sql
               1 File(s)             54 bytes
               0 Dir(s)  22.308.741.120 bytes free

SQL> $cd c:\temp                                     --> changing the directory

SQL> $dir *.sql
 Volume in drive C has no label.
 Volume Serial Number is B0C4-68EB

 Directory of C:\                                    --> nothing changed (we'd rather see C:\TEMP here)

05.06.2007  21:35                54 test.sql
               1 File(s)             54 bytes
               0 Dir(s)  22.308.786.176 bytes free

SQL> exit

C:\>                                                 --> again, no change here
Previous Topic: Unable to EDIT Query - Excel 97
Next Topic: How do I set the very large memory - VLM in windows 2K3?
Goto Forum:
  


Current Time: Fri Mar 29 10:16:15 CDT 2024