[oracle@kook bin]$ cat test.sh
sqlplus -S "/ as sysdba" << !
select to_char(sysdate,'yyyy-mm-dd') today from dual;
exit;
!
执行结果
[oracle@test scrip]$ sh time.sh
TODAY
----------
2010-08-01
如果去掉S参数,执行结果如下
[oracle@test scrip]$ sh time.sh
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Aug 1 16:08:59 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
TODAY
----------
2010-08-01
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
以上是去掉S参数的输出结果
还可以这样写
[oracle@kook bin]$ cat test.sh
sqlplus -S << !
conn / as sysdba
select to_char(sysdate,'yyyy-mm-dd') today from dual;
exit;
!
在用ftp命令时也有类似的对应参数“-n”.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16566331/viewspace-670106/,如需转载,请注明出处,否则将追究法律责任。
本文介绍了如何使用 SQL*Plus 的 -S 参数来简化 Oracle 数据库查询脚本的执行过程,并对比了使用与不使用该参数时的不同输出效果。
493

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



