Oracle游标类型作为传入传出参数:
--游标类型传入参数
DECLARE
/*CURSOR cur_ttt IS
SELECT 1 a FROM dual;*/
TYPE typ_cur IS REF CURSOR;
val_cur typ_cur;
PROCEDURE temp_sp1(x_cur OUT typ_cur) IS
BEGIN
OPEN x_cur FOR SELECT 1 a FROM dual UNION ALL SELECT 2 FROM dual;
END;
PROCEDURE temp_sp2(p_cur IN typ_cur) IS
i NUMBER;
BEGIN
LOOP
FETCH p_cur INTO i;
EXIT WHEN p_cur%NOTFOUND;
dbms_output.put_line(i);
END LOOP;
CLOSE p_cur;
END;
BEGIN
temp_sp1(val_cur);
temp_sp2(val_cur);
OPEN val_cur FOR SELECT 3 a FROM dual UNION ALL SELECT 4 FROM dual;
temp_sp2(val_cur);
END;