0

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?

Z.Szymon
  • 337
  • 1
  • 13
  • 4
    put_line can only accept 32k characters (max varchar2). This is a common question, see https://stackoverflow.com/questions/26723362/oracle-ora-06502-pl-sql-numeric-or-value-error-dbms-output – kfinity Feb 19 '19 at 17:10
  • Wow you were right! Thank you! – Z.Szymon Feb 19 '19 at 18:52

0 Answers0