Press "Enter" to skip to content

How to Enable DBMS_OUTPUT in Toad for Oracle?

DBMS_OUTPUT package generates the output to the screen in Oracle if used in PL/SQL programs. But to view the printed text, there is a need to run a specific command in Oracle. In Toad, there are three ways to enable output for DBMS_OUTPUT statements. Here are the examples:

Enable Output For DBMS_OUTPUT Statements in Toad For Oracle

Method – 1

  1. In Toad, click on the menu View > Toad Options to open the Options window.
  2. In the Options window, click on the Execute/Compile option under the Editor node.
  3. Then on the right side, click the option Poll for DBMS_OUTPUT to check the check-box and then click on the Apply and OK button to apply the setting permanently as shown in the below image. Now whenever you will run any PL/SQL program having the DBMS_OUTPUT statement, you will be able to view its output in DBMS Output window.

Enable DBMS_OUTPUT in Toad for Oracle

Method – 2

  1. In Toad, before running any PL/SQL program having the DBMS_OUTPUT statement, enable the output for DBMS Output window by clicking on the Red round icon, and it will turn to Green when it is on (below is a screenshot). This method is manual and every time you need to do when you restart the Toad.

DBMS Output Window in Toad for Oracle

Method – 3

  1. Put the SET SERVEROUTPUT ON statement before the PL/SQL program block to print the output of DBMS_OUTPUT statement on the Script Output Window in Toad and run the program by pressing the key F5. Below is an example:
SET SERVEROUTPUT ON
BEGIN
    DBMS_OUTPUT.PUT_LINE('Hello World!');
END;
/

Output

Hello World!
PL/SQL procedure successfully completed.

See also: