MSSQL的存储过程返回数据集好简单,直接SELECT 就可以。
ORACLE的存储过程返回数据集必须通过游标。
创建ORACLE存储过程
create or replace procedure cxg_test(out_var out sys_refcursor)
is begin open out_var for select * from a; end; 调用ORACLE存储过程declare
cur_calling sys_refcursor; v_row A%ROWTYPE; begin cxg_test(cur_calling); LOOP FETCH cur_calling INTO v_row; EXIT WHEN cur_calling%NOTFOUND; DBMS_OUTPUT.PUT_LINE(v_row.aaaaa1||','||v_row.aaaaa2||','||v_row.aaaaa3); END LOOP; CLOSE cur_calling; end ;