Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    18

    Unanswered: problem to insert bfile

    my steps are:-

    create directory adphoto_dir as '/temp/';
    grant read on directory adphoto_dir to scott;
    connect scott/tiger;

    declare
    the_file bfile;
    the_doc blob;
    doc_size integer;
    begin
    the_file:=bfilename('C:\WINNT\temp','new');
    doc_size := DBMS_LOB.GETLENGTH(the_file);
    DBMS_LOB.FILEOPEN(the_file);
    DBMS_LOB.LOADFROMFILE(the_doc,the_file,doc_size);
    DBMS_LOB.FILECLOSE(the_file);
    commit;
    end;



    ERROR at line 1:
    ORA-22285: non-existent directory or file for GETLENGTH operation
    ORA-06512: at "SYS.DBMS_LOB", line 547
    ORA-06512: at line 7

    plz help me out from this prob.
    Thanks.

  2. #2
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    The problem is with this line:

    Code:
    the_file:=bfilename('C:\WINNT\temp','new');
    The first parameter for "bfilename" is a the Oracle directory structure type, not the O/S directory. Change 'C:\WINNT\temp' to be 'ADPHOTO' and it should work.

    Couple of things:

    1) all functions/procedures accepting the directory structure type is particular about upper and lower case, so make sure 'ADPHOTO' is UPPER case

    2) from your CREATE DIRECTORY command, it looked like you were on a unix machine, however for your BFILENAME function, you entered a Windows path. Make sure your file is in the /temp directory of your Oracle server, NOT the client.

    Hope this helps.

    JoeB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •