oracle如何返回结果集?
create or replace procedure test
(ResultCur Out Sys_Refcursor)
is
begin
open ResultCur for
SELECT * from module_tree;
end test;
初学 oracle,编译通过,但是测试的时候没有返回结果集,请教哪里出了问题!
------解决方法--------------------------------------------------------
CREATE OR REPLACE PROCEDURE Ll_02 (p_cursor OUT sys_refcursor) IS
BEGIN
OPEN p_cursor FOR
SELECT * FROM B_AREAS;
END Ll_02;
-------------------------------------------------------------
DECLARE
P_CURSOR sys_refcursor;
v_row B_AREAS%ROWTYPE;
BEGIN
-- P_CURSOR := NULL; Modify the code to initialize this parameter
ET_STATISTICS.Ll_02 ( P_CURSOR );
LOOP
FETCH p_cursor INTO v_row;
EXIT WHEN p_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_row.area_id);
END LOOP;
--COMMIT;
END;
--
O
E
S
M
W
N
H