oracle 在 Toad 的输出参数中显示结果

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3546101/
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-10 02:45:07  来源:igfitidea点击:

Display results in output parameter in Toad

oraclestored-proceduresplsqltoad

提问by devang

I have a stored procedure in Oracle and I'm using an out parameter in it.. I want to know how to display the output in Toad..

我在 Oracle 中有一个存储过程,我在其中使用了一个 out 参数..我想知道如何在 Toad 中显示输出..

回答by Craig

You just need to declare a variable to store the value in, and then do whatever you want with the data afterwards. If you are just wanting to see the output, dbms_output is probably the easiest way to go:

你只需要声明一个变量来存储值,然后对数据做任何你想做的事情。如果您只想查看输出,dbms_output 可能是最简单的方法:

declare
  -- declare variable to store out data in.  Make sure datatype is correct
  v_out VARCHAR2(50);
begin
  -- call procedure, assigning value of out parameter to variable you declared
  my_proc(
    p_in => 3,
    p_out => v_out
  );
  -- display value now in variable
  dbms_output.put_line('Value of p_out: '||v_out);
end;

回答by JulesLt

In the Toad schema browser, click the 'Execute' button, which will generate some test code for calling your procedure, and writing the OUT parameter via dbms_output. Check the output in the dbms_output window (you may need to activate output in the dbms_output window using the two leftmost icons)

在 Toad 模式浏览​​器中,单击“执行”按钮,这将生成一些用于调用过程的测试代码,并通过 dbms_output 写入 OUT 参数。检查 dbms_output 窗口中的输出(您可能需要使用最左边的两个图标激活 dbms_output 窗口中的输出)

回答by prashant

In Toad after execution of a query you can see Multiple Options like Data Grid, Auto Trace, DBMS Output etc...

在执行查询后的 Toad 中,您可以看到多个选项,如数据网格、自动跟踪、DBMS 输出等...

  1. Goto option DBMS Output.
  2. If Output is Turn Off (Red Dot), then click over it to Turn it On (Green).
  3. Now Execute your query with CTRL+Enter
  4. This will show result after Poling Frequency Seconds.
  1. 转到选项 DBMS 输出。
  2. 如果输出为关闭(红点),则单击它以将其打开(绿色)。
  3. 现在执行您的查询 CTRL+Enter
  4. 这将在 Polling Frequency Seconds 后显示结果。

Trial Code :

试用代码:

DECLARE 
    c number(4);
BEGIN
    c := 4;
    dbms_output.put_line(c);
END;
/

enter image description here

在此处输入图片说明