title: Copying data from a text file to a CLOB in PL/SQL
body: <p>I have used the following code to copy the text from a file to a CLOB. However it is giving me a PL/SQL numeric or value error at the position where writeappend is performed. </p>
  
  <pre><code>    declare
    l_fhandle utl_file.file_type;
    l_clob    CLOB;
    l_buffer  VARCHAR2(4096);
  BEGIN
    l_fhandle := utl_file.fopen('/data',
                                'FILE.TXT',
                                'R');
    dbms_lob.createtemporary(l_clob, TRUE, DBMS_LOB.CALL);
    LOOP
      BEGIN
        utl_file.get_line(L_FHANDLE, l_buffer);
        dbms_output.put_line(l_buffer);
       dbms_lob.writeappend(l_clob, length(l_buffer), l_buffer);
  
      EXCEPTION
        WHEN no_data_found THEN
          dbms_output.put_line('Inside No data found');
          INSERT INTO TAB_CLOB_FILE
            (FILENAME, BODYCONT)
          VALUES
            ('FILE', l_clob);
            dbms_output.put_line('Inserted data into table');
          EXIT;
  
      END;
    END LOOP;
  END;
  </code></pre>
  
  <p>Please help me figure out what is wrong</p>