ITPub博客

首页 > 数据库 > 数据库开发技术 > PL/SQL cursor

PL/SQL cursor

原创 数据库开发技术 作者:maojinyu 时间:2010-09-04 14:42:14 0 删除 编辑

CURSOR

1 declare
cursor a(i number) is select * from test where id=i;
b test%rowtype;
begin
open a(i=>1) ;
loop
fetch a into b;
exit when a%notfound;
dbms_output.put_line(b.name);
end loop;
close a;
end;

2 declare

begin
for a in (select * from test) loop
dbms_output.put_line(a.name);
end loop;
end;


3 declare
cursor b(i number) is select * from test where id=i;
begin
for c in b(i=>1) loop
dbms_output.put_line(c.name);
end loop;
end;

4

declare
cursor a is select * from mao where rownum<100;
b mao%rowtype;
begin
for b in a loop
dbms_output.put_line(b.name);
end loop;
end;

[@more@]

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

上一篇: Linux change date time
请登录后发表评论 登录
全部评论

注册时间:2012-05-09

  • 博文量
    178
  • 访问量
    376683