How to get my PUT_LINE statement to display in TOAD?

Caffeinated picture Caffeinated · Jul 25, 2014 · Viewed 38.8k times · Source

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

Answer

Michael S. picture Michael S. · Jul 25, 2014

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.