在ORACLE的SQL PLUS中运行脚本时,如果脚本中利用@@调用其它脚本,往往需要写绝对路径,给我们带来不便,其实可以设置ORACLE的类路径,使得在脚本中调用其它脚本时,只需相对路径就可以了。下面以ORCALE 11g为例讲述具体设置过程:
假设ORACLE安装路径是E:\APP,则在E:\app\Administrator\product\11.1.0\db_1\BIN目录下找到srvconfig.bat文件,编辑此文件,找到set CLASSPATH="E:\app\Administrator\product\11.1.0\db_1\jlib\srvm.jar;E:\app\Administrator\product\11.1.0\db_1\jlib\srvmhas.jar;%JREJAR%",在这里修改为:
set CLASSPATH=".;E:\app\Administrator\product\11.1.0\db_1\jlib\srvm.jar;E:\app\Administrator\product\11.1.0\db_1\jlib\srvmhas.jar;%JREJAR%"
如此,就可以在SQL PLUS中使用相对路径了。