Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Blob insert oracle v8

Re: Blob insert oracle v8

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 05 Jun 1998 14:43:16 GMT
Message-ID: <357903a3.4779662@192.86.155.100>


A copy of this was sent to vince31_at_my-dejanews.com (if that email address didn't require changing) On Thu, 04 Jun 1998 23:49:04 GMT, you wrote:

>Hello, i am a french student of university. For my school, i must to do a
>project with Oracle V8 and Blob object. I must to insert in the database
>oracle V8 some pictures and sound, and i don t know how could i do. If there
>are people who is knowing the procedure to insert and use pictures and sound
>(BLOB) with oracle V8, i hope, you can send me some good exemple of there
>procedure. Thanks a lot. Please send me the procedure, thanks. Vince my
>E-mail : n.peral_at_wanadoo.fr bye bye
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading

Its this easy in pl/sql:

drop table blobs;

create table blobs
( id varchar2(255),
  theBlob blob
)
/

create or replace directory MY_FILES as '/export/home/tkyte/public_html';

declare

    l_bfile bfile;
    l_blob blob;
begin

    insert into blobs values ( 'MyGif', empty_blob() )     return theBlob into l_blob;

    l_bfile := bfilename( 'MY_FILES', 'aria.gif' );     dbms_lob.loadfromfile( l_blob, l_bfile, dbms_lob.getlength(l_bfile) );     commit;
end;
/

That does the whole thing for you....  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jun 05 1998 - 09:43:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US