Oracle SQL Developer:在网格中显示 REFCURSOR 结果?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3556336/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:22:02  来源:igfitidea点击:

Oracle SQL Developer: Show REFCURSOR Results in Grid?

oraclestored-proceduresoracle-sqldeveloper

提问by technomalogical

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

作为问题“从 oracle 存储过程中获取结果集”的后续问题,是否有一种方法可以显示REFCURSOR在 SQL Developer 中的网格(而不是纯文本脚本输出窗口)中返回 a 的存储过程的结果?

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

编辑:答案有所帮助,但我仍然无法在“查看值”窗口中显示结果集:

alt text

替代文字

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:

列只能扩展少量,可能是由于返回的结果数量。使用 resizer 控件扩展窗口无济于事:

alt text

替代文字

采纳答案by Ian Carpenter

I don't think you can with a procedure.

我不认为你可以通过程序。

Edit:Thanks to DCookie for simplifying my original answer.

编辑:感谢 DCookie 简化了我的原始答案。

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

但是作为一种变通方法,您可以编写一个调用该过程的函数,然后使用 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.

运行此示例时,SQL Developer 数据网格显示一个结果,但如果向右滚动并单击编辑按钮,您将在网格中看到结果。