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!

UTL_FILE - reading file in subdirectory

JackKJun 1 2011 — edited Jun 1 2011
Hi,
I've got DIRECTORY object (SWDE_DIR) pointing to directory /oradata/mydata. There is also directory /oradata/mydata/dir1 with several files. I am able to run
create or replace function get_filesize(p_file varchar2) return number is
  v_exists boolean;
  v_length number;
  v_blocksize number;
begin
  UTL_FILE.fgetattr('SWDE_DIR', p_file, v_exists, v_length, v_blocksize);
  if v_exists then
    return v_length;
  end if;
  return -1;
end get_filesize;
When I run
SELECT get_filesize('1.swd') FROM dual;
the result is correct size of the file.
However, when I run
SELECT get_filesize('dir1/sub1.swd') FROM dual;
the result is -1. I'm sure, the file exists there.
What may be wrong?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2011
Added on Jun 1 2011
4 comments
1,793 views