如何在Oracle SQL Developer中查看refcursor结果/输出? [英] How to see refcursor result/output in Oracle SQL Developer?

查看:348
本文介绍了如何在Oracle SQL Developer中查看refcursor结果/输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
获得结果的最佳方法/工具从oracle打包过程中获取
Oracle SQL Developer:在网格中显示REFCURSOR结果?

Possible Duplicate:
Best way/tool to get the results from an oracle package procedure
Oracle SQL Developer: Show REFCURSOR Results in Grid?

我是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...

这篇关于如何在Oracle SQL Developer中查看refcursor结果/输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆