Results 1 to 6 of 6

Thread: File input/output in Pl/Sql

  1. #1
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Error while creating a text file

    While creating a text file using utl_file it is showing error message ora-29280: invalid directory path

    I have set the path in init.ora in server as
    utl_file_dir = 'd:\orahome\bin'

    This is procedure code
    create or replace procedure test_filehandling as
    filehandle utl_file.file_type;
    writemessage varchar2(200);
    begin
    filehandle := utl_file.fopen('\\10.15.1.197\d\orahome\bin','test.txt','w');
    writemessage := 'this is created for testing purpose \n' || ' \n this is the second line';
    utl_file.putf(filehandle,writemessage);
    writemessage := ' line by line code using putline';
    utl_file.put_line(filehandle,writemessage);
    utl_file.fflush(filehandle);
    utl_file.fclose(filehandle);
    end;
    /
    could anyone suggest me what is wrong with the code?

    Last edited by krishnaindia2007; 01-05-2008 at 03:05 AM.

  2. #2
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: File input/output in Pl/Sql

    To check Directory name,directory path use this query
    select directory_name , directory_path from all_directories
    To create Directory name use this query
    CREATE OR REPLACE DIRECTORY TEST_UTIL AS 'C:\TEMP'
    use directory name in place of \\10.15.1.197\d\orahome\bin
    ex: filehandle := utl_file.fopen('test_util','test.txt','w'); Then ur procedure will work

    Last edited by susarlasireesha; 01-05-2008 at 05:47 AM.

  3. #3
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: File input/output in Pl/Sql

    Thank you for you suggestion. Now I am getting error
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 449
    ORA-29283: invalid file operation
    ORA-06512: at "PAYLIVE.TEST_FILEHANDLING", line 9

    and 9th line in my code is
    FILEHANDLE := UTL_FILE.FOPEN('TEST_UTIL','TEST.TXT','W');

    Could you suggest what might be the problem?


  4. #4
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: File input/output in Pl/Sql

    The problem was solved. In server C Drive is not in shared mode.


  5. #5
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: File input/output in Pl/Sql

    Can't we give directly existing folder path like this
    \\10.15.1.197\D\MYFOLDER
    without creating a directory as
    CREATE OR REPLACE DIRECTORY TEST_UTIL AS 'C:\TEMP'

    I tried but once again it is showing message ORA-29280: invalid directory path.

    What is the reason?


  6. #6
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: File input/output in Pl/Sql

    oracle refers to the virtual directory created not to system directory.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact