如何在 Oracle SQL Developer 中查看 refcursor 结果/输出?

可能的重复:
获得结果的最佳方式/工具来自 oracle 程序包
Oracle SQL Developer:在网格中显示 REFCURSOR 结果? >

我是 Oracle SQL Developer 的新手.我使用的是 Oracle SQL Developer 3.0 版.我试图使用以下查询来测试我的 SP.

I am new to Oracle SQL Developer. I am using Oracle SQL Developer Version 3.0. I was trying to test my SP using the following query.

DECLARE
  type output_cursor is ref cursor;
  P_CURSOR output_cursor;
BEGIN
  P_CURSOR := NULL;
  myPackage.mySPTest (  P_NOTIFICATION_ID => 1975357,P_CURSOR => P_CURSOR) ;
END;

当我在 Oracle SQL Developer 中运行上述查询时,我收到一条消息匿名块已完成",但没有显示任何结果.

When I ran the above query in my Oracle SQL Developer, I am getting a message 'anonymus block completed' and its not showing any result.

谁能帮我看看结果如何.

Can anyone help me, how to see the result.

.

推荐答案

可以使用 SQL Developer 中声明的绑定变量来保存和显示结果:

You can use a bind variable declared in SQL Developer to hold and show the results:

var r refcursor;
exec myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r);
print r;

exec 是匿名块的简写,所以这相当于:

exec is shorthand for an anonymous block so this is equivalent to:

var r refcursor;
begin
    myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r);
end;
/
print r;

除非 P_CURSOR 被声明为无用的东西,否则可能...

Unless P_CURSOR is declared as something unhelpful, maybe...

相关文章