pl sql儲存過程中游標巢狀的實現方法

2021-04-29 00:44:49 字數 562 閱讀 3836

游標2用游標1每條記錄中的條件查詢

游標2用引數實現,其中mystring varchar2(20);是測試用的變數

如下create or replace procedure cursor_example

asmystring 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;

Oracle儲存過程中多層巢狀游標的用法

oracle sql指令碼 create or replace procedure p delete qk pid in number,deep in number as pid 分類id deep 深度,層級 one val number two val number three val numb...

儲存過程中帶游標

create procedure updatetimeproperty surroundingrock nvarchar 200 ifclassname nvarchar 200 prop startstation nvarchar 200 prop endstatoin nvarchar 200 ...

儲存過程中的游標使用

利用儲存過程來消除資料庫中冗餘的資料 create procedure sp mytest as declare pro varchar 50 declare mm int declare wu cursor for select distinct product from mytest open ...