How to get my PUT_LINE statement to display in TOAD?

点点圈 提交于 2019-12-13 11:42:11

问题


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

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 ) ?


回答1:


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.




回答2:


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

How to use

  1. select the code in place
  2. Editor > Execute SQL via QSR

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

Hope it helps!!!



来源:https://stackoverflow.com/questions/24959889/how-to-get-my-put-line-statement-to-display-in-toad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!