陋室铭
永远也不要停下学习的脚步(大道至简至易)

游标2用游标1每条记录中的条件查找
游标2用参数实现,其中MyString VARCHAR2(20);是测试用的变量
如下

create or replace procedure cursor_example
as
MyString VARCHAR2(20);

CURSOR SelectContent IS
select A1,A2 from A;

CURSOR SelectContent2(A1String in varchar2) IS
select B1,B2 from B where B.B1=A1String;

begin
  for cursor1 in SelectContent
    loop
      MyString := cursor1.A1;
      for cursor2 in SelectContent2(cursor1.A1)
        loop
           MyString := cursor2.B2;
        END loop;
    END loop;
end cursor_example;

posted on 2007-11-18 11:01  宏宇  阅读(3068)  评论(0编辑  收藏  举报