在shell中获取sql的执行结果

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

 

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

你可能感兴趣的:(linux)