pl/sql存储过程中游标嵌套的实现方法

游标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;

原文地址:https://www.cnblogs.com/cuihongyu3503319/p/963065.html