I want to load a file into plsql clob variable and then perform some regexp transformations on it. The problem I have is that I'm not able to print the freshly loaded file using dbms_output and I have no idea why. So far I tried:
declare
l_filename varchar2(100) := 'sample_file.txt';
l_clob clob;
l_bfile bfile;
begin
dbms_lob.createtemporary(l_clob, true);
l_bfile := bfilename( 'SAMPLE_DIR', l_filename );
dbms_lob.fileopen( l_bfile );
dbms_lob.loadfromfile( l_clob, l_bfile, dbms_lob.getlength( l_bfile ));
dbms_lob.fileclose( l_bfile );
--dbms_output.put_line(l_clob);
end;
/
Now the dbms_output.put_line() line is commented out and everything is working fine but uncommenting this line causes ora-06502 'numeric or value error' to occur. Why is this happening?