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
shell脚本与sql文件传参,不使用存储过程
本文展示了如何使用 SQL*Plus 工具执行包含 SQL 语句的外部文件。通过一个简单的示例,介绍 set 命令的使用及如何从文件中读取并执行 SQL 语句,最后退出 SQL*Plus 的过程。

被折叠的 条评论
为什么被折叠?



