@命令的使用

@命令与start命令类似,区别在于:@命令既可以在SQL*Plus会话中运行,也可以在操作系统命令提示符中运行,而start命令只能在SQL*Plus会话中运行。

例如 在E盘中有一个sql文件query2.sql内容:

select empno,ename,job
from emp
where empno >&1 ;

 使用@命令:

C:\Users\lmh>sqlplus scott/tiger @e:/query2.sql

SQL*Plus: Release 11.1.0.7.0 - Production on 星期二 11月 16 19:00:25 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

输入 1 的值:  7899
原值    3: where empno >&1
新值    3: where empno >7899

     EMPNO ENAME      JOB
---------- ---------- ---------
      7900 JAMES      CLERK
      7902 FORD       ANALYST

 或者可以直接在后面接上变量的值:

C:\Users\lmh>sqlplus scott/tiger @e:/query2.sql  7780

SQL*Plus: Release 11.1.0.7.0 - Production on 星期二 11月 16 19:05:16 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

原值    3: where empno >&1
新值    3: where empno >7780

     EMPNO ENAME      JOB
---------- ---------- ---------
      7782 CLARK      MANAGER
      7788 SCOTT      ANALYST
      7839 KING       PRESIDENT
      7844 TURNER     SALESMAN
      7876 ADAMS      CLERK
      7900 JAMES      CLERK
      7902 FORD       ANALYST
      7934 MILLER     CLERK

已选择8行。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值