
empno=100不存在的,改成有的数据了。
#!/bin/bash
result=$(sqlplus -s 'scott/tiger@dbname'<<EOF
spool testtxt
set pages 0
set feed off
set heading off;
set feedback off;
set verify off;
set linesize 1000;
SELECT FROM scottemp where empno=7369;
spool off
EOF
)
echo $result
~
~
~
~
~
~
~
~
~
"testsh" 14L, 256C written
oracle@:~> /testsh
7369 SMITH CLERK 7902 17-DEC-80 224006 20
oracle@:~> more testtxt
7369 SMITH CLERK 7902 17-DEC-80 224006
20
放在一个批处理中执行就可以了
use natdb
go
declare @Nrows integer
select @Nrows=count() from test_userdata
if @Nrows>0
update
else
insert
go
以上就是关于linux下编写以个shell脚本,实现对oracle数据库的查询结果保存在一个变量中全部的内容,包括:linux下编写以个shell脚本,实现对oracle数据库的查询结果保存在一个变量中、在shell脚本中使用 isql 执行SQL语句 查询sybase数据库中满足条件的记录条数,怎么把查询结果赋给变量、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)