for p in (select id,fid,name from table1 where cid=p_cid) loop for q in(select tid,tname from table2 where fid=p.fid) loop ... end loop end loop;
谢谢realx(iambird) ,能不能具体点..
是不是这样: for p in (select id,fid,name from table1 where cid=p_cid) loop for q in(select tid,tname from table2 where fid=p.fid) loop insert into table3(tname)values(q.tname); end loop end loop; 就可以了
是这样用的,p,q自己随便定义好了,用a,b也行
顺便问一下:select table1.f1,table2.f2 from table1 left join table2 on table1.id=table2.id,出现这样的错误: 出现符号 "JOIN"在需要下列之一时: , ; for group having intersect minus order start union where connect
for q in(select tid,tname from table2 where fid=p.fid) loop
...
end loop
end loop;
for p in (select id,fid,name from table1 where cid=p_cid) loop
for q in(select tid,tname from table2 where fid=p.fid) loop
insert into table3(tname)values(q.tname);
end loop
end loop;
就可以了
出现符号 "JOIN"在需要下列之一时: , ; for group having intersect minus order start union where connect