急!如何从一个shell文件中传递一个参数到sql文件中,不能用存储过程

CenturyMagus 2007-08-06 09:44:42
就是在一个shell文件中调用一个sql文件,并传递一个参数到这个sql文件中,不能用存储过程
...全文
266 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ATGC 2007-08-06
  • 打赏
  • 举报
回复
aa.sql的内容

select * from &tablename;

E:\>sqlplus system/genome @e:\aa.sql

SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 6 12:18:56 2007

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

输入 tablename 的值: dual
原值 1: select * from &tablename
新值 1: select * from dual

D
-
X

SQL>
CenturyMagus 2007-08-06
  • 打赏
  • 举报
回复
谢谢两位大哥的帮忙啊,我验证后马上给分!
bobfang 2007-08-06
  • 打赏
  • 举报
回复
C:\tmp>type test.sql
set verify off
select '&1' from dual;
exit

C:\tmp>sqlplus username/password@server @test.sql "any string"

SQL*Plus: Release 9.2.0.1.0 - Production on 星期一 8月 6 13:37:12 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


连接到:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production


'ANYSTRING'
--------------------
any string

从Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production中断开

C:\tmp>

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧