Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.
Anyone who needs a multi-line version of DBMS_OUTPUT.PUT_LINE?
This is one of my favorite swiss knife utilities, a handy procedure called PUT_LINES that allows you to forget the limitation of 255 characters per line of DBMS_OUTPUT.PUT_LINE.
Download put_lines.sql source file.
The idea is to split a multi-line source string (p_str) into chunks of the specified maximum length (p_chunk), possibly at any existing newline (p_newline) or at any breaking character (p_breaks) like spaces (default), commas, semicolons, etc., whichever comes last.
A hard break at the chunk length will occur only if no suitable breaking character has been found in the second half of each line, but you can make this threshold bigger or smaller as desired (p_threshold).
In other simple terms, i am trying to split the string in a user-friendly format.
For the sake of simplicity, I've embedded a private function called RIGHTMOST as comments in the declaration section of PUT_LINES.
You can either make this function independent if you deem that it could be useful in other situations (as i think) or simply uncomment it to keep it private and compile PUT_LINES without external references.