SQL 如何让我的 PUT_LINE 语句显示在 TOAD 中?

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

How to get my PUT_LINE statement to display in TOAD?

sqltoad

提问by Coffee

This code compiles, but in TOAD it won't show the "hi wo" output

这段代码可以编译,但在 TOAD 中它不会显示“hi wo”输出

CREATE OR REPLACE PROCEDURE AdelTest IS
tmpVar NUMBER;

BEGIN

  DBMS_OUTPUT.ENABLE(100: in INTEGER);
  DBMS_OUTPUT.PUT_LINE('hi wo');
    tmpVar := 0;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      NULL;
    WHEN OTHERS THEN
      --consider logging error then r-raise
    RAISE;
END AdelTest;

How do I show the output(similar to how println shoots to console in Java ) ?

如何显示输出(类似于 println 如何在 Java 中发送到控制台)?

回答by Michael S.

You need to enable DBMS Output. If working in the Editor right-click and choose DBMS Output off of the Desktop flyout menu. There's a button that is red if it's disabled. Click it and it will turn green. Then execute your code. Output will display there. If you are working outside of the Editor (in Schema Browser for instance) select DBMS Output off of the main Toad View menu. Enable your output there. Output will display in that window.

您需要启用 DBMS 输出。如果在编辑器中工作,请右键单击并从桌面弹出菜单中选择 DBMS 输出。如果禁用,则有一个按钮为红色。点击它,它会变成绿色。然后执行你的代码。输出将显示在那里。如果您在编辑器之外工作(例如在模式浏览器中),请从 Toad 视图主菜单中选择 DBMS 输出。在那里启用您的输出。输出将显示在该窗口中。

回答by Ashish Gupta

You can also view server output if for some reason DBMS output window is not getting enable. use QSReditor embedded within toad for oracle edition..

如果由于某种原因 DBMS 输出窗口未启用,您还可以查看服务器输出。使用QSR嵌入在 toad 中的编辑器进行 oracle 版..

How to use

如何使用

  1. select the code in place
  2. Editor > Execute SQLvia QSR
  1. 选择适当的代码
  2. 编辑器 > 执行SQL通过QSR

have the set serveroutputon as first statement in QSR window and run.. now it will show output in window..

将设置serveroutput作为 QSR 窗口中的第一条语句并运行.. 现在它将在窗口中显示输出..

Hope it helps!!!

希望能帮助到你!!!

回答by harun ugur

In the Editor right-click and choose DBMS Output off of the Desktop flyout menu. There's a button that is red if it's disabled. Click it and it will turn green. Then execute your code.

在编辑器中右键单击并从桌面弹出菜单中选择 DBMS 输出。如果禁用,则有一个按钮为红色。点击它,它会变成绿色。然后执行你的代码。