declare
v_date date;begin
v_date:=date'2011-6-1';loop
execute immediate'
insert into table1
select a.aa ,b.bb
from table2@yy a,table3@yy b
where b.bb=a.dd and a.cc=v_date
and a.ee = ''0''
';
v_date:=v_date+1;
exit when v_date > date'2011-6-30';
end loop;
commit;
end;
报错的地方是 v_date invalid identifier
v_date date;begin
v_date:=date'2011-6-1';loop
execute immediate'
insert into table1
select a.aa ,b.bb
from table2@yy a,table3@yy b
where b.bb=a.dd and a.cc=v_date
and a.ee = ''0''
';
v_date:=v_date+1;
exit when v_date > date'2011-6-30';
end loop;
commit;
end;
报错的地方是 v_date invalid identifier
declare
v_date date;begin
v_date:=date'2011-6-1';loop
execute immediate'
insert into table1
select a.aa ,b.bb
from table2@yy a,table3@yy b
where b.bb=a.dd and a.cc= ''' || v_date || '''
and a.ee = ''0''
';
v_date:=v_date+1;
exit when v_date > date'2011-6-30';
end loop;
commit;
end;
你的语法不对 是MSSQL的语法
能说一下为什么要加那么多引号么-.-我对plsql还在摸索阶段...谢谢
呵呵。。
这个不需要啥教程啊~~ 只要能把字符串拼出来就好了~ 插到一个测试table的栏位里 看看是否正常 不正常再调整引号的数量 · 调几次就知道了