linux shell 查询oracle数据库中的值 并返回
#!/bin/bash
dbserver=10.21.2.152
port=1521
username=COLDB2
password=creditderivative
sid=orcl
select_sql="select count(*) as rowsCount from f3distcalccounter;"
rowsCount=`sqlplus -s ${username}/${password}@${dbserver}:${port}/${sid} <<EOF
set pagesize 0 heading off echo off termout off feedback off linesize 1200 colsep "," trimspool on trimout on
${select_sql}
quit;
EOF`
echo ${rowsCount}1 : sqlplus 后面的 -s 很重要
2:
set pagesize 0 heading off echo off termout off feedback off linesize 1200 colsep "," trimspool on trimout on
更多的可以参考 :
http://jingyan.baidu.com/article/c35dbcb0f104448917fcbc72.html
相关推荐
laisean 2020-11-11
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
CARBON 2020-10-20
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16