Print more than 256 Characters using dbms_output.put_line
dbms_output.put_line has limitation and we cannot print data that is more than 250 char. The following put_line procedure splits the data into pieces of length 250 char and prints the data using dbms_out.put_line.
procedure put_line(p_data in varchar2) is
ln_chars_to_print pls_integer;
ln_print_posn pls_integer;
ln_linefeed_posn pls_integer;
ln_print_offset pls_integer;
begin
--
-- Split data at each chr(10) (line feed character) or 250 char
--
ln_chars_to_print := length(p_data);
ln_print_posn := 1;
while ln_chars_to_print > 0 loop
ln_linefeed_posn := instr(p_data, chr(10), ln_print_posn);
if ln_linefeed_posn = 0 then
ln_linefeed_posn := ln_print_posn + 250;
end if;
ln_print_offset := ln_linefeed_posn - ln_print_posn;
dbms_output.put_line(substr(p_data, ln_print_posn, ln_print_offset));
ln_print_posn := ln_linefeed_posn + 1;
ln_chars_to_print := ln_chars_to_print - ln_print_offset;
end loop;
end put_line;