ITPub博客

首页 > 数据库 > Oracle > 关于在Oracle存储过程内使用循环及select的其他写法。

关于在Oracle存储过程内使用循环及select的其他写法。

原创 Oracle 作者:pds911 时间:2007-08-02 09:59:39 0 删除 编辑

现在发现使用for in loop...end loop;用起来挺好

cursor c1 is

select columnA, columnB from tableA;

cursor c2 is --现在看来还比较常用

select b.columnA,

(select c.columnA

from tableC c

where c.columnB = b.columnB

and rownum=1

) as columnB,

b.columnC

from tableA b;

begin

for r1 in c1 loop

insert into tableB values(r1.columnA, r1.columnB);

commit;

end loop;

end;

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/81211/viewspace-930461/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 想购买DC
请登录后发表评论 登录
全部评论
  • 博文量
    22
  • 访问量
    657031