在shell中获取sql的执行结果

来源:互联网 发布:浩兴软件 编辑:程序博客网 时间:2024/04/30 16:21

com=`sqlplus -silent /nolog <<E
conn user/pwd
set pagesize 0 feedback off verify off heading off echo off numwidth 10
select c01001 from c01;
exit;
end`

 

或者

 

com=`sqlplus -S /nolog <<EOF
conn user/pwd
set pagesize 0 feedback off verify off heading off echo off numwidth 10
select c01001 from c01;
exit;
end`

 

如果需要进一步处理,则需要用cut或者awk 处理查询结果。

原创粉丝点击