0
我在oracle中使用plsql过程。我需要检索多个行。我的部分代码..使用oracle plsql过程如何获取表中的多行或全部行
CREATE OR REPLACE procedure PC_APP.Test_proc1() is
BEGIN
SELECT * from table;
END;
我在oracle中使用plsql过程。我需要检索多个行。我的部分代码..使用oracle plsql过程如何获取表中的多行或全部行
CREATE OR REPLACE procedure PC_APP.Test_proc1() is
BEGIN
SELECT * from table;
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
CREATE PROCEDURE PC_APP.Test_proc1 (prc out sys_refcursor)
IS
BEGIN
OPEN prc for SELECT * from mytable;
END;