写了个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 2011Copyright (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 optionsSQL>
COUNT(*)
----------
1130SQL> 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后便得到数据值
#!/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 2011Copyright (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 optionsSQL>
COUNT(*)
----------
1130SQL> 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后便得到数据值
解决方案 »
- 请教一下,ORACLE如何限制用户对表的访问?
- oracel中两个timestamp差值的问题?
- oracle developer连接oracle数据库出现the network adapter cannot establish the connection
- 将一列中所有的点号改为横线
- 偶发现一个很好的Oracle技术论坛,大家有什么Oracle疑问快去那个论坛问,那里有很多技术高超的版主为你及时解决!!!
- 如果某表不存在的话创建表,存在的话做更新请问应该如何写
- 菜鸟问题,安装和初始化数据库问题
- 新手to_date() 函数的疑惑~
- 新建一数据库,独立登陆OEM看的到,登陆到OMS就看不到,请指教!在线等!
- oracle中 if exists (select) update ...else ...insert 怎样写?
- 麻烦谁有metalink账户,帮忙查个bug吧,谢谢
- 建个序列
set linesize 1024;
set feedback off;
oracle@mns101:~/shell> cat test.sh
#!/bin/cshsqlplus -l -s scott/tiger@ora11 << !
set pagesize 0;
set linesize 1024;
set feedback off;
select * from dual;
exit;
!
oracle@mns101:~/shell> csh test.sh
X
oracle@mns101:~/shell>
set pagesize 0;
select count(*) from tableName;
!
set pagesize 0;
set linesize 1024;
set feedback off;
select sysdate from dual;
exit;
!bsh test.sh--result:
2011/11/12