Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: inserting images into BLOB column
A copy of this was sent to "André Hartmann" <Andre.Hartmann_at_pace.de>
(if that email address didn't require changing)
On Tue, 25 Jan 2000 17:40:04 +0100, you wrote:
>Hi,
>
> thanx a lot from me as well since this clue helped me along a bit...
>unfortunately it doesnt work for me fully. I am accessing the Oracle Server
>via SQL*Net as a client... so the file that I want to insert is not on the
>Server's file system and I dont have access to that file system. I get:
>
>ERROR at line 1:
>ORA-22288: file operation FILEOPEN failed
>LFI-00108: Open expect the file [2000.01][txt] to exist.
>ORA-06512: at "SYS.DBMS_LOB", line 370
>ORA-06512: at line 8
>
>So how can I insert my file (rather the binary data in it) into the database
>... dbms_lob.write doesnt seem to work either since I keep getting:
>
>ERROR at line 1:
>ORA-21560: argument 2 is null, invalid, or out of range
>ORA-06512: at "SYS.DBMS_LOB", line 518
>ORA-06512: at "UADB_DEV.EXAMPLE_16", line 12
>ORA-06512: at line 1
>
>.. when I try Example_16 out of the Oracle8 documentation....
>
which oracle8 document (specify also 8.0 or 8.1). I don't know where example 16 is.
What language are you using?
>André Hartmann.
>newby at the group.
>
>>>
>>
>>
>>See the details on the dbms_lob package. You can read/write lobs 32k at a
>time
>>(sort of like fread/fwrite in C). You can load lobs from files in one
>call.
>>
>>Here is a short example but see the plsql manual in 8.0 or the LOB manual
>in 8i.
>>
>>
>>
>>drop table demo;
>>
>>create table demo
>>( id int primary key,
>> theBlob blob
>>)
>>/
>>
>>create or replace directory my_files as '/export/home/tkyte/public_html';
>>
>>declare
>> l_blob blob;
>> l_bfile bfile;
>>begin
>> insert into demo values ( 1, empty_blob() )
>> returning theBlob into l_blob;
>>
>> l_bfile := bfilename( 'MY_FILES', 'aria.gif' );
>> dbms_lob.fileopen( l_bfile );
>>
>> dbms_lob.loadfromfile( l_blob, l_bfile,
>> dbms_lob.getlength( l_bfile ) );
>>
>> dbms_lob.fileclose( l_bfile );
>>end;
>>/
>>
>>
>>
>>
>>--
>>See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to
>Oracle8i'...
>>Current article is "Part I of V, Autonomous Transactions" updated June
>21'st
>>
>>Thomas Kyte tkyte_at_us.oracle.com
>>Oracle Service Industries Reston, VA USA
>>
>>Opinions are mine and do not necessarily reflect those of Oracle
>Corporation
>
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Jan 25 2000 - 11:19:48 CST