← PL/SQL Topics

Advanced & Performance

Explain DBMS_OUTPUT and basic debugging techniques in PL/SQL

DBMS_OUTPUT and Debugging

Oracle Fusion / EBS · Technical · PL/SQL

GeneralHigh confidence

Writes to an in-memory buffer your client prints after the block finishes — not a live console.

Grounded in: Curated Oracle knowledge layer — PL/SQL

How it works

DBMS_OUTPUT.PUT_LINE writes to an in-memory buffer that your client (SQL*Plus, SQL Developer, etc.) reads and prints after the block finishes — it isn't a live console, and shows nothing unless the client has SERVEROUTPUT turned ON with a buffer large enough for what's being printed. For anything beyond quick ad hoc tracing, most environments prefer a real logging table or an IDE-integrated debugger, since DBMS_OUTPUT is invisible to a caller that isn't specifically watching for it — a scheduled job, a REST call.

How it works
SET SERVEROUTPUT ON SIZE UNLIMITED;

BEGIN
  DBMS_OUTPUT.PUT_LINE('Starting batch...');
  FOR v_i IN 1..3 LOOP
    DBMS_OUTPUT.PUT_LINE('Processing row ' || v_i);
  END LOOP;
  DBMS_OUTPUT.PUT_LINE('Done.');
END;
/

Related Questions

Have a follow-up, or a different question?

Continue in Ask Oracle AI