oracledirectoryconfigurationplsqldevelopercommand-window

How do I set the default directory that the PL/SQL Developer Command Window opens in?


I'm trying to run a script in a sql file in PL/SQL Developer. I open a command window and I find myself not in the directory where the sql script is.

enter image description here

I encounter a couple issues when trying to navigate to the directory:

  1. cd into the directory sometimes gives the message "Could not change directory".

  2. Switching to the c: drive (where the script is) doesn't work. In a typical (Windows) command terminal, I would just type "c:" and it would switch to the c: drive. Doing that in the PL/SQL Developer command window doesn't do anything. Typing "cd c:" takes me to a weird place with a bunch of dll's but not the root of c:.

I'm wondering if there's a way to configure PL/SQL Developer to open the command window to a default directly, ideally the one where I keep my sql scripts. Maybe the fact that I get the message "could not change directory" means it doesn't have access to that directory, but I don't know why that message pops up.

The work arounds I've been using are:

a) Move the sql file to the current directory the command window is open in. This is not ideal not just because it means I have to move the file but also that PL/SQL Developer doesn't seem to be consistent in the directory it opens the command window in.

b) Type out the full path to where the sql file is when running it but this is tedious and I don't want to do this every time (the fact that this works indicates to me that PL/SQL Developer does have access to the target directory so the message "could not change directory" doesn't have anything to do with access).

Even if I could cd my way to the target directory, it is tedious to do this every time, and setting a default directory to open in would be a great improvement. I appreciate any help I can get. Thank you.


Solution

  • To change the default directory for the PL/SQL Developer Command Window, go to Configure-->Preferences-->Files-->Directories and set the "Command files" directory: enter image description here

    Although in general I would recommend that you use the SQL*Plus command line for running scripts, and use PL/SQL Developer for development and analysis. If you're building scripts that you will eventually hand off to DBAs, you're going to run into lots of cases where SQL*Plus clones do not implement the same behavior or bugs as the real thing. (And yes, you want those bugs in development. If you're going to hit a 2500 character line limit on production, you want to hit it in dev first. Last I checked, PL/SQL Developer did not imitate that bug.)

    Also, whenever you want to look up a feature in PL/SQL Developer, in the preferences window, type a related word in the text box, hit enter, and the preferences window may go to the relevant setting.