10

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

Caffeinated
  • 11,982
  • 40
  • 122
  • 216

4 Answers4

12

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.

Michael S.
  • 1,771
  • 15
  • 20
  • 2
    If you are on Toad 12.1 or newer you can enable Smart Polling in the Editor. On the DBMS Output docked panel see the third button from the left. It has the lightning bolt and green refresh icon. Select it so that it is depressed. Now just execute as you normally would and all output is picked up. No need to manually enable it. This feature exists in the Editor only. – Michael S. Jul 25 '14 at 17:54
  • 1
    I forgot about this option as well. "Enable DBMS Output before debug session" should be checked in Options on the Debugger tab. – Michael S. Jul 25 '14 at 20:05
  • You also need to push "Poll for output" button or enable "Automatically poll for output after execution" option to see the results (which took me to figure it out a while). – Doğa Gençer Nov 02 '18 at 08:11
0

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!!!

Rohit Poudel
  • 1,793
  • 2
  • 20
  • 24
0

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.

harun ugur
  • 1,718
  • 18
  • 18
0

Need to enable the Automatically poll for output after execution under DBMS Output

DECLARE
    v_text VARCHAR2(20); -- declare
BEGIN
    v_text := 'Hello World';  --assign
    dbms_output.Put_line(v_text); --display
END; 

enter image description here

caot
  • 3,066
  • 35
  • 37