DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: working with LOb-Large Objects in oracle

  1. #1
    Join Date
    Aug 2001
    Location
    mumbai
    Posts
    1

    Exclamation

    I m creating following proc to read external lob and strore in photo field of myimages table
    structure of table myimages

    id varchar2(3), photo blob

    i have created a virtual directory from oracle which is mapped to physical directory

    by command :-

    create directory PICS as 'D:/images';
    grant read on directory PICS to public;


    the physical directory is having golf.gif file. its printing the length of the file
    using getlength method. but loadfromfile method gives error msg as
    value error invalid lob locator. if i place any other file like jpg also still it gives same error.

    what could be the error....

    create or replace procedure procblob as
    lobd blob := empty_blob();
    locator bfile := bfilename('PICS','golf.gif');
    amt number;

    begin
    amt := dbms_lob.getlength(locator);
    dbms_output.put_line('size of file is ' || amt);
    dbms_lob.fileopen(locator,dbms_lob.file_readonly);
    dbms_lob.loadfromfile(lobd,locator,amt);

    insert into myimages values('2',null,lobd);
    commit;
    end;


  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Sep 2001
    Posts
    1

    Smile

    Don't know if you've fixed this yet but you need to lock the destination LOB prior to calling LoadFromFile.

    --initialiaze the LOB column
    insert into myimages values('2',empty_blob());

    --lock the destination LOB
    select photo
    into lobd
    from myimages
    where id = '2'
    for update;

    Hope this helps

Posting Permissions

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


Click Here to Expand Forum to Full Width