Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"

Problem:
Connecting to the database APPS_MANPOWER_PLUS_APPS.
ORA-29282: invalid file ID
ORA-06512: at "SYS.UTL_FILE", line 878
ORA-06512: at "APPS_MANPOWER_PLUS.PKG_UPD_BULK", line 421
ORA-06512: at line 6
--------------------------------------------------------------------------------
Process exited.


, generated by:
 
(...) 
  begin
    dbms_output.enable(null);
   
    dbms_output.put_line(RPAD('-',80,'-'));
    utl_file.put_line(lf, RPAD('-',80,'-'));
   
    l_logfile_name := 'UPD_XXX' || '_' || to_char(sysdate, 'YYYYMMDDHH24MISS') || '.log';

    lf := utl_file.fopen('OPERATION_LOGS', l_logfile_name, 'W');

   
    dbms_output.put_line('BEGIN: PKG_UPD_BULK.UPD_
XXX');
    utl_file.put_line(lf, 'BEGIN: PKG_UPD_BULK.UPD_
XXX');
(...) 

Cause:
Write in the file before first open it. The correct code should be:

(...) 
  begin
    dbms_output.enable(null);
   

    l_logfile_name := 'UPD_XXX' || '_' || to_char(sysdate, 'YYYYMMDDHH24MISS') || '.log';
    lf := utl_file.fopen('OPERATION_LOGS', l_logfile_name, 'W');


     dbms_output.put_line(RPAD('-',80,'-'));
    utl_file.put_line(lf, RPAD('-',80,'-'));
   
    dbms_output.put_line('BEGIN: PKG_UPD_BULK.UPD_
XXX');
    utl_file.put_line(lf, 'BEGIN: PKG_UPD_BULK.UPD_
XXX');
(...) 

Comments

Popular posts from this blog

Hibernate - HibernateException: createQuery is not valid without active transaction