Oracle SQL Developer: Show REFCURSOR Results in Grid?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 04:37:59

问题


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 in a grid (instead of the plain text Script Output window) within SQL Developer?

EDIT: The answer helped, but I'm still having a problem displaying the result set in the "View Value" window:

The columns can only be expanded a small amount, probably due to the number of results being returned. Expanding the window with the resizer control doesn't help:


回答1:


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.



来源:https://stackoverflow.com/questions/3556336/oracle-sql-developer-show-refcursor-results-in-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!