【发布时间】:2011-05-21 19:57:50
【问题描述】:
我正在尝试编写一个简单的查询脚本来获取表中的行数。但是,我面临抑制各种 oracle 消息的问题。我感兴趣的是输出:
这是我的脚本:
#!/usr/bin/ksh
sqlplus /nolog <<EOF
connect user/pswd@databse
set serveroutput on
set heading off
set feedback off
select count(*) from table;
exit;
EOF
我的输出如下所示:
.desktop% sh sql.ksh
SQL*Plus: Release 10.2.0.2.0 - Production on Tue Dec 7 12:00:42 2010
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> Connected.
SQL> SQL> SQL> SQL>
70
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
我想要的只是没有任何消息的数字 70,以便我可以定期将其写入日志等。我知道我可以解析数字,但每次查询或架构更改时我都必须更改它。我不能只要求 mysqlplus 禁止所有这些消息吗?
【问题讨论】:
标签: sql oracle shell scripting sqlplus