How to return multiple rows from the stored procedure? (Oracle PL/SQL)

前端 未结 5 1994
野的像风
野的像风 2020-11-27 11:19

I want to create a stored procedure with one argument which will return different sets of records depending on the argument. What is the way to do this? Can I call it from p

5条回答
  •  鱼传尺愫
    2020-11-27 11:28

    I think you want to return a REFCURSOR:

    create function test_cursor 
                return sys_refcursor
                is
                        c_result sys_refcursor;
                begin
                        open c_result for
                        select * from dual;
                        return c_result;
                end;
    

    Update: If you need to call this from SQL, use a table function like @Tony Andrews suggested.

提交回复
热议问题