Print long messages to DBMS_OUTPUT

The Oracle supplied package DBMS_OUTPUT has a number of limitations, one of these is a 255 character line limit. Of course Tom Kyte has a solution.

 


   -- print long messages to DBMS_OUTPUT
   --  see http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:146412348066
   PROCEDURE p( p_string IN VARCHAR2 ) IS
      l_string   LONG DEFAULT p_string;
   BEGIN
      LOOP
         EXIT WHEN l_string IS NULL;
         DBMS_OUTPUT.put_line( SUBSTR( l_string, 1, 250 ) );
         l_string := SUBSTR( l_string, 251 );
      END LOOP;
   END;

   p( 'Start of message' );
   p( str_vlong_string );
   p( 'End of message');

 

 

82 views

Need help? Let me take care of your IT issues.

Share this page

Scroll to Top