CREATE OR REPLACE PROCEDURE P_TESTA (
PRESULT OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN PRESULT FOR SELECT * FROM USERS;
END P_TESTA;
想在另外的存储过程中接收我的结果集 在输出中应该定义什么类型
SQL> create or replace procedure P_TESTB
2 as
3 v_result sys_refcursor;
4 type a_type is table of a%rowtype;
5 v_a a_type;
6 begin
7 P_TESTA(v_result);
8 fetch v_result bulk collect into v_a;
9 for i in v_a.first .. v_a.last loop
10 dbms_output.put_line(v_a(i).id);
11 end loop;
12 end;
13 /
Procedure created
SQL> set serveroutput on;
SQL> execute p_testb;
1
1
2
3
2
3
4
5
1
11
PL/SQL procedure successfully completed