我在 oracle 中使用 plsql 过程。我需要检索多行。我的部分代码..
CREATE OR REPLACE procedure PC_APP.Test_proc1( ) is
BEGIN
SELECT * from table;
END;
我在 oracle 中使用 plsql 过程。我需要检索多行。我的部分代码..
CREATE OR REPLACE procedure PC_APP.Test_proc1( ) is
BEGIN
SELECT * from table;
END;
CREATE PROCEDURE PC_APP.Test_proc1 (prc out sys_refcursor)
IS
BEGIN
OPEN prc for SELECT * from mytable;
END;
您将需要使用 Ref Cursors来允许从存储过程和函数返回记录集。
CREATE PROCEDURE PC_APP.Test_proc1 (prc out sys_refcursor)
IS
BEGIN
OPEN prc SELECT * from mytable;
END;
在命令行上
SQL> var rc refcursor
SQL> execute prc(:rc)
SQL> print rc