如何从oracle更改文件路径

How do I change the path of file from oracle

我有 ubuntu 14.04oracle XE 11 如果要从 Oracle 执行文件 sql 我会:

SQL > @ /........./Desktop/file.sql 

如何更改 oracle 的路径,意味着我在桌面创建文件 我是:

SQL > @ file .sql

您可以在运行 SQL*Plus 之前设置$SQLPATH 环境变量。来自 the documentation:

SQLPATH - Environment variable or Windows registry entry to specify the location of SQL scripts. SQL*Plus searches for SQL scripts, including login.sql, in the current directory and then in the directories specified by SQLPATH, and in the subdirectories of SQLPATH directories. SQLPATH is a colon separated list of directories. There is no default value set in UNIX installations.

所以:

export SQLPATH=/........./Desktop
sqlplus

或者,在启动之前 cd 到桌面目录 SQL*Plus,因为无论如何它都会首先在当前目录中查找脚本。

@alex poole 获胜!

一点额外的想法;就像 unix PATH 变量一样,您可以在 SQLPATH 变量中定义多个路径,因此 sqlplus 可以在多个位置查找引用的脚本。