Re: Utl_file.

From: Alexxx12 <member14441_at_dbforums.com>
Date: Sun, 23 Mar 2003 02:37:53 +0000
Message-ID: <2674575.1048387073_at_dbforums.com>


Hi:

[Quoted] [Quoted] I created a directory using this code:

[Quoted] 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

--
Posted via http://dbforums.com
Received on Sun Mar 23 2003 - 03:37:53 CET

Original text of this message