读书人

待求高手!

发布时间: 2012-01-11 22:28:46 作者: rapoo

在线等待,求高手!!
写了个shell脚本(testdb.sh)如下:
#!/bin/csh
sqlplus hbjs/hbjs@js_test_10gr2 <<!
select count(*) from dps_module_log where FILE_NAME like 'B%.791' and total_count=0;
!
运行后输出为


SQL*Plus: Release 9.2.0.1.0 - Production on Tue Oct 11 16:23:19 2011

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

SQL>
COUNT(*)
----------
1130

SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options



我只想要1130这个值 希望运行脚本后返回值为1130,该怎么做!!!!
不能借助其他程序或脚本。只运行testdb.sh后便得到数据值

[解决办法]
select 语句之前加以下几个设置

set pagesize 0;
set linesize 1024;
set feedback off;
[解决办法]
slqplus -l -s $1/$2@$3 <<!
set pagesize 0;
select count(*) from tableName;
!

[解决办法]

SQL code
#!/bin/bshsqlplus -l -s sbs/sbs@topprod << !set pagesize 0;set linesize 1024;set feedback off;select sysdate from dual;exit;!bsh test.sh--result:2011/11/12 

读书人网 >oracle

热点推荐