d: est.sql脚本如下:
- select &1 from &2;
- exit;
执行时这样传参数:sqlplus "scott/tiger@test" @d: est.sql sysdate dual
注意:参数必须用&[1-9]表示,不然传不进去,会提示让手动输入参数- C:>sqlplus "scott/tiger@test" @d: est.sql sysdate dual
-
- D:>sqlplus "scott/tiger@test" @d: est.sql sysdate dual
-
- SQL*Plus: Release 11.2.0.1.0 Production on 星期二 11月 1 21:59:00 2011
-
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
-
-
- 连接到:
- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
-
- 原值 1: select &1 from &2
- 新值 1: select sysdate from dual
-
- SYSDATE
- --------------
- 01-11月-11
-
- 从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options 断
- 开
-
- D:>
如果脚本中有重复用到相同的值,如果&1=&2:d: es2.sql
- delete scott.emp where no=&1 or deptno=&2;
- commit;
执行时,就必须传2个参数:
- sqlplus "scott/tiger@test" @d: est2.sql 10 10
小窍门: 这时用procedure就可以不用传多个相同的参数,则只用传1个参数:d: est3.sql
- declare
- var_no number:=&1;
- begin
- delete scott.emp where no=var_no or deptno=var_no;
- commit;
- end;
sqlplus "
scott/tiger@test" @d: est3.sql 10Oracle中大批量删除数据的方法Oracle导机迁移全过程相关资讯 Oracle数据库 Oracle入门教程 oracle数据库教程
- Oracle数据库全球化 (03月01日)
- Oracle数据库日期过滤方法性能比较 (02/02/2015 13:20:26)
- Oracle数据库安装中端口被占用问题 (10/29/2014 07:42:24)
| - 在CentOS 6.6上搭建C++运行环境并 (10/10/2015 19:44:40)
- Oracle数据库无法使用localhost和 (11/14/2014 16:39:10)
- 使用SQLT来构建Oracle测试用例 (08/28/2014 06:17:41)
|
本文评论 查看全部评论 (0)