先定义一个cursor:
Procedure P_MYPROC (
PI_PARAM VARCHAR2
)IS
VI_A VARCHAR2(10):='';
VI_B VARCHAR2(20):='';
VI_C VARCHAR2(30):='';
--定义
CURSOR MYCUR IS
SELECE T.A ,T.B, T.C
FROM TBL_MYTABLE T;
BEGIN
--打开
OPEN MYCUR;
--遍历
LOOP
FETCH MYCUR
INTO VI_A,VI_B,VI_C;
--无数据时退出
EXIT WHEN MYCUR%NOTFOUND;
--DO SOMETHING HERE;
END LOOP;
END P_MYPROC;