How does one change the current directory in SQL Plus under windows.
I am trying to write a script with several "@ filename" commands.
I know that one can open a script with the File --> Open command, which will change the current directory, but I am looking for a way to do this automatically unattended.
Based on Plasmer's response, I set the SQLPATH environment variable in Windows, and got something that's good enough for me. I did not try to set it with the HOST command (I doubt that it will work).
Pourquoi Litytestdata's answer is a good one, but will not work for me (the directories are too far apart). And of course Guy's answer that it cannot be done is also correct. I will vote these two up, and accept Plasmer's answer.
The cd (change directory) command enables you to move around within the file-system hierarchy. Although your home directory is /export/home/user1 , the cd command returns you to the /home/user1 because home directories are mounted on the /home directory by the automounter.
Go to Tools>Preferences>Database>Export and Browse to the location you want to export to for "Directory".
List all the directories for which you have the privileges. SELECT * FROM dba_directories a WHERE EXISTS (SELECT 1 FROM all_tab_privs WHERE table_name = a. directory_name AND grantee = USER);
Answer: The glogin. sql file allows you to store global settings for all SQL*Plus queries. The file is localed at $ORACLE_HOME/sqlplus/admin/glogin.
Here is what I do.
Define a variable to help you out:
define dir=C:\MySYSTEM\PTR190\Tests\Test1
@&dir\myTest1.sql
You can't cd
in SQL*Plus (you can cd
using the host command, but since it is a child process, the setting won't persist in your parent process).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With