1. Home
  2. Docs
  3. Oracle to PostgreSQL Migration
  4. 9 PLSQL vs plpgsql
  5. 9.2 Migrating DBMS_OUTPUT.PUT_LINE

9.2 Migrating DBMS_OUTPUT.PUT_LINE

Oracle’s DBMS_OUTPUT package is typically used for debugging or for displaying output messages from PL/SQL anonymous blocks, stored procedures, packages or triggers.

PUT_LINE is a procedure within DBMS_OUTPUT package that takes a VARCHAR2 data type as input parameter. This procedure places a line in the buffer which can be displayed on screen when you use SET SERVEROUTPUT ON. When you call DBMS_OUTPUT.PUT_LINE the item you specify is automatically followed by an end-of-line marker.

In PostgreSQL, RAISE statement is used to report messages and raise errors. PostgreSQL provides level option to specify with RAISE that specifies the severity of the statement. Possible levels with RAISE are DEBUGLOGNOTICEWARNINGINFO and EXCEPTION.

Learn the usage of different levels with RAISE statement in PostgreSQL in our below blog post.

Our recommendation for DBMS_OUTPUT.PUT_LINE

Migrate Oracle database DBMS_OUTPUT.PUT_LINE to RAISE NOTICE/RAISE INFO for code debugging and RAISE EXCEPTION for error handling.

Was this article helpful to you? Yes No

How can we help?