views:

65

answers:

2

After doing DEFINE_EDITOR=vi . I wrote

SQL > edit sample.sql

This is being stored in Jagan/Documents by default. But i want this to be stored in Jagan/Documents/plsql. Can anybody tell how to do this..

A: 

In Windows you can specify the default location of scripts via the "Starts In" property of the shortcut for SQL Plus, or via the SQLPATH registry entry.

In Unix you would use the ORACLE_PATH enviroment variable.

See the SQL Plus docs for more details.

Tony Andrews
export ORACLE_PATH=/home/Jagan/Documents/plsql. I placed it in .bashrc . Still it is creating files in Documents only.
Jagan
I'm afraid I don't know enough Unix to help further. You can add the "plsql" to the path like this: "edit plsql/sample.sql"
Tony Andrews
`ORACLE_PATH` only seems to affect where you can run and edit existing files from, so `@sample.sql` will look for `sample.sql` in which ever directory `ORACLE_PATH` points to *before* looking in your current directory; if the same file exists in both it'll use the one under `ORACLE_PATH`. Editing an existing file with `edit sample.sql` does the same thing, as does `get sample.sql`. But editing or creating a new file with `edit new.sql` or `save new.sql` always writes to the current directory if you don't give it a path. [Oracle 10g/Solaris]. You can of course `cd $HOME/plsql` first too.
Alex Poole
A: 

It's pretty simple. This will open a new file in the /tmp directory:

SQL> edit /tmp/sample.sql
APC
It did not work.
Jagan
@Jagan - Well, I tested it and that solution worked for me. Did you get an error message or what? Also, which version of the database? Version of SQL*Plus client? Flavour and version of *nix?
APC