Capturing PL/SQL Debug Text with DBMS_OUTPUT in SQL Developer
Stop guessing why your PL/SQL blocks aren't printing. Learn how to configure DBMS_OUTPUT in SQL Developer using both GUI and script methods to capture debug text.
23 Feb 2026, 21:28 UTC

Why DBMS_OUTPUT Text Disappears
If a PL/SQL block calls DBMS_OUTPUT.PUT_LINE but nothing appears in SQL Developer, the database is not discarding your text by accident. The Oracle Database stores that text in a session-scoped memory buffer, and SQL Developer only retrieves it when you explicitly enable the output path. Without that step, the buffer fills and is silently cleared, so your debug lines never reach the client.
Two Ways to Turn Output On
You can enable output from the GUI or from the worksheet. Both approaches cause SQL Developer to call DBMS_OUTPUT.ENABLE for the current session, run your code, and then fetch the buffered lines with DBMS_OUTPUT.GET_LINES.
Enable from the DBMS Output tab
- Open the DBMS Output tab for your connection (usually via View > DBMS Output).
- Click Enable DBMS Output and choose the active connection.
Enable from the SQL Worksheet
Run the SQL*Plus-compatible command SET SERVEROUTPUT ON before your PL/SQL block. This is a script directive, so execute it with Run Script (F5) rather than Run Statement (Ctrl+Enter).
Worked Example
The following block is the smallest reliable test. Run it in the SQL Worksheet as a script (F5) with the DBMS Output tab visible.
SET SERVEROUTPUT ON;
BEGIN
DBMS_OUTPUT.PUT_LINE('hello');
END;
/
If the output path is active, the text hello should appear in the DBMS Output tab after the block finishes. If the tab stays blank, re-check that you enabled the correct connection and that you used Run Script.
Buffer Limits and ORA-20000
The DBMS_OUTPUT buffer is finite. A loop that emits thousands of lines can trigger ORA-20000: ORU-10027: buffer overflow, or in some versions the text may be truncated without an error. To raise the limit, either call DBMS_OUTPUT.ENABLE with a larger size in your block, or adjust the buffer size under Tools > Preferences > Database > Worksheet. The effective default varies by SQL Developer and Oracle Database version, so confirm the configured value before relying on very large debug output.
Common Mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Forgetting to enable output | PUT_LINE runs but text is discarded | Click Enable DBMS Output or run SET SERVEROUTPUT ON |
| Using Run Statement for SET SERVEROUTPUT ON | Command is ignored or treated as SQL | Use Run Script (F5) for the SET command |
| Expecting output from another session or an autonomous transaction | Lines are missing because the buffer is session-scoped | Enable and view output in the same session that runs the code |
| Reconnecting or restarting SQL Developer | Output stops appearing | Re-enable the tab or re-run SET SERVEROUTPUT ON; the setting does not persist |
| Waiting for real-time lines during a long block | Screen looks empty until completion | Output is fetched after the statement finishes; wait for the block to end |
How to Verify Your Setup
- Connect to the database and open the DBMS Output tab.
- Click Enable DBMS Output for that connection.
- Run the BEGIN ... END; block above and confirm the text appears.
- To test the ceiling, generate more lines than the buffer allows and observe whether you get ORA-20000 ORU-10027 or silent truncation.
- Check Tools > Preferences > Database > Worksheet and compare the configured buffer size with the error limit.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.