Oracle SQL Developer: Show REFCURSOR Results in Grid?

后端 未结 1 1422
旧时难觅i
旧时难觅i 2020-12-06 07:03

As a follow-up to the question \"Get resultset from oracle stored procedure\", is there a way to show the results of a stored procedure that returns a REFCURSOR

相关标签:
1条回答
  • 2020-12-06 07:09

    I don't think you can with a procedure.

    Edit: Thanks to DCookie for simplifying my original answer.

    But as a work-around you can write a function that calls the procedure and then invoke that using SQL.

    e.g.

    create or replace function callmyproc
    return sys_refcursor
    IS
       rc   sys_refcursor;
    BEGIN
    
       myproc(rc);
    
       return rc;
    
    END;
    

    Which you can then call with:

       select callmyproc()
       from dual;
    

    When this example is run, the SQL Developer data grid shows one result but if you scroll right and click on the edit button, you will see the results in a grid.

    0 讨论(0)
提交回复
热议问题