在线等待,求高手!!
写了个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/bsh
sqlplus -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