当前位置: 技术问答>linux和unix
unix shell 里调用sql ,请帮手分析问题,谢谢
来源: 互联网 发布时间:2016-08-28
本文导语: 请看下述代码... shell: ..... $ORACLE_HOME/bin/sqlplus /nolog @${path}/change.sql ${pama1} ${pama2} ..... change.sql: connect ... declare vv varchar2(10); cursor c is select name from table; begin for rec in c loop beg...
请看下述代码...
shell:
.....
$ORACLE_HOME/bin/sqlplus /nolog @${path}/change.sql ${pama1} ${pama2}
.....
change.sql:
connect ...
declare
vv varchar2(10);
cursor c is
select name
from table;
begin
for rec in c
loop
begin
vv:=trim(rec.name);
spool /baanV/sh/forecast/log/change_&1._&2._&vv..xls -- 为什么vv值取不到呢,该怎么写?
select *
from forecast_change_&1._&2._&vv;
spool off
end;
end loop;
end;
/
exit;
shell:
.....
$ORACLE_HOME/bin/sqlplus /nolog @${path}/change.sql ${pama1} ${pama2}
.....
change.sql:
connect ...
declare
vv varchar2(10);
cursor c is
select name
from table;
begin
for rec in c
loop
begin
vv:=trim(rec.name);
spool /baanV/sh/forecast/log/change_&1._&2._&vv..xls -- 为什么vv值取不到呢,该怎么写?
select *
from forecast_change_&1._&2._&vv;
spool off
end;
end loop;
end;
/
exit;
|
先用sqlplus user/pwd@host