Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

File not getting created using UTL_FILE

1567114Dec 13 2016 — edited Dec 13 2016

Hello,

I am using the below block for generating file in unix  box directory /u01/tmp.The pl/sql procedure is getting completed with no error and exception but file not getting created

Please can anyone help me on this

DECLARE

  l_file utl_file.file_type;

BEGIN

  l_file := utl_file.fopen( 'TEST', 'Test.csv', 'W' );

  utl_file.put_line( l_file, 'Here is some text' );

  utl_file.fclose( l_file );

exception

      WHEN UTL_FILE.internal_error THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An internal error occurred.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.invalid_filehandle THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: The file handle was invalid.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.invalid_mode THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid open mode was given.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.invalid_operation THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid operation was attempted.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.invalid_path THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid path was give for the file.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.read_error THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A read error occurred.');

        UTL_FILE.FCLOSE_ALL;

    WHEN UTL_FILE.write_error THEN

        DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A write error occurred.');

        UTL_FILE.FCLOSE_ALL;

    WHEN others THEN

        DBMS_OUTPUT.PUT_LINE ('Some other error occurred.');

        UTL_FILE.FCLOSE_ALL;

END;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2017
Added on Dec 13 2016
22 comments
4,736 views