Re: Utl_file.

From: SoulSurvivor <markyg_7_at_yahoo.co.uk>
Date: 24 Mar 2003 02:07:49 -0800
Message-ID: <8d9c6fd.0303240207.5de1207_at_posting.google.com>


The create or replace directory books_dir as 'c:\books' will NOT create a physical directory on your PC This only creates a logical pointer to it WITHIN Oracle. You will have to go into DOS or Windoes Explorer and create c:\books yourself.

Also, UTL_FILE is a server based tool and will not work on a client machine. So if c:\books is on a client, no chance!

Also, use line 9 and not 10.

Mark

Alexxx12 <member14441_at_dbforums.com> wrote in message news:<2674575.1048387073_at_dbforums.com>...
> Hi:
>
> I created a directory using this code:
>
> LOCAL>create or replace directory books_dir as 'c:\books';
>
> Directory created.
>
> LOCAL>
>
> but it did not create a directory on my c:\ drive. But I proceeded
> to execute
> the code below but the error that follow. Why?? What am I doing wrong?
>
> LOCAL>declare
> 2 v_bookfile bfile;
> 3 v_dirname varchar2(30);
> 4 v_location varchar2(2000);
> 5 v_fileisopen integer;
> 6 v_fileexists integer;
> 7
> 8 begin
> 9 -- v_bookfile := bfilename('Books_dir','book1.gif');
> 10 v_bookfile := bfilename('c:\books','test.sql');
> 11 v_fileisopen := dbms_lob.fileisopen(v_bookfile);
> 12
> 13 v_fileexists := dbms_lob.fileexists(v_bookfile);
> 14
> 15 if v_fileexists = 1 then
> 16 dbms_output.put_line('The file exists.');
> 17 else
> 18 dbms_output.put_line('The file cannot be found.');
> 19 end if;
> 20
> 21 if v_fileisopen = 1 then
> 22 dbms_output.put_line('The file is open.');
> 23 else
> 24 dbms_output.put_line('Opening the file.');
> 25 dbms_lob.fileopen(v_bookfile);
> 26 end if;
> 27
> 28 dbms_lob.filegetname(v_bookfile, v_dirname,v_location);
> 29 dbms_output.put_line('The Directory Object is: ' || v_dirname ||
> 30 ' The file Name is: ' || v_location);
> 31
> 32 dbms_lob.fileclose(v_bookfile);
> 33 end;
> 34 /
> declare
> *
> ERROR at line 1:
> ORA-22285: non-existent directory or file for FILEEXISTS operation
> ORA-06512: at "SYS.DBMS_LOB", line 456
> ORA-06512: at line 13
>
> What am I doing wrong??
>
> Alex
Received on Mon Mar 24 2003 - 11:07:49 CET

Original text of this message