Difference between '@' and '@@' in SQL*PLUS


(1)When you enter @file_name.ext, SQL*Plus searches for a file with that filename and extension in the current default directory. If SQL*Plus does not find the file in the current directory, it searches a system-dependent path to find it. Some operating systems may not support the path search. See the platform-specific Oracle documentation provided for your operating system for specific information related to your operating system environment.

(2)When you enter @@file_name.ext from within a script, SQL*Plus runs file_name.ext from the same directory as the script.
When you enter @@file_name.ext interactively, SQL*Plus runs file_name.ext from the current working directory or from the same url as the script. from which it was called.If SQL*Plus does not find the file, it searches a system-dependent path to find the file.Some operating systems may not support the path search. See the platform-specific Oracle documentation provided for your operating system for specific information related to your operating system environment.

Examples
Suppose that you have the following script. named PRINTRPT:
SELECT DEPARTMENT_ID, CITY FROM EMP_DETAILS_VIEW WHERE SALARY>12000;
@EMPRPT.SQL
@@ WKRPT.SQL
When you START PRINTRPT and it reaches the @ command, it looks for the script. named EMPRPT in the current working directory and runs it. When PRINTRPT reaches the @@ command, it looks for the script. named WKRPT in the same path as PRINTRPT and runs it.
Suppose that the same script. PRINTRPT was located on a web server and you ran it with START HTTP://machine_name.domain:port/PRINTRPT. When it reaches the @ command, it looks for the script. named EMPRPT in the current working directory and runs it. When PRINTRPT reaches the @@ command, it looks for the script. named WKRPT in the same url as PRINTRPT, HTTP://machine_name.domain:port/WKRPT.SQL and runs it.

Reference:
SQL*Plus®
User’s Guide and Reference
Release 11.1
B31189-01

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13940/viewspace-612648/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/13940/viewspace-612648/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值