如何使用 Toad 从 Oracle 中的函数获取返回值
如何在 Toad 中找出函数的返回值是什么?
我正在运行类似这样的代码:
declare r number;
begin
r:= packagename.functionname(paraname);
end;
我无法弄清楚如何将“r”返回到数据网格,一些帖子建议使用 DBMS 输出,但当我运行代码时没有写入任何内容。
该函数执行更新、提交、调用其他函数并在其中包含游标。
How do I find out in Toad what the return value of a function is?
I'm running something like this code:
declare r number;
begin
r:= packagename.functionname(paraname);
end;
I can't work out how to get "r" returned to the data grid, some posts suggest using DBMS output but nothing is written to it when I run the code.
The function performs updates, commits, calls other functions and has cursors in it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在运行此命令之前,您需要打开输出。为此,请选择编辑器底部的“DBMS 输出”选项卡,然后单击该选项卡下最左边的按钮(它应该描绘一个红色圆圈,并带有工具提示“打开输出”(如果是绿色圆圈,则输出已经开启))。
查询的结果将写入“DBMS 输出”窗口,而不是“数据网格”(您可能需要等待几秒钟轮询才能获取结果)。如果您使用用户定义的类型或引用游标,这将是不够的,您需要在写出之前在匿名块中处理结果。
You'll need to turn output on before running this. To do that, select the "DBMS Output" tab at the bottom of the editor, then click the leftmost button under the tab (it should depict a red circle, with the tooltip "Turn Output On" (if it's a green circle, output is already on)).
The results of the query will be written to the "DBMS Output" window, not the "Data Grid" (you may have to wait a few seconds for the polling to pick up the results). If you use a user-defined type or a ref cursor, this will be insufficient and you'll need to process the results in the anonymous block before writing them out.
怎么样:
How about just:
克劳斯的回答
对我有用,但它只返回一个光标。这在 Toad 的数据网格中显示为 (CURSOR)。一旦我双击它,它就会打开一个新窗口,其中包含该光标的数据网格,我看到了结果。
The answer from Klaus of
worked for me but it only returned a cursor. This displayed as (CURSOR) in the data grid in Toad. Once I double clicked on that, it opened a new windows with a data grid for that cursor and I saw my results.