Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to store binary data (pictures) in a Oracle database
<krain_at_bk.bosch.de> wrote:
>I would like to know how to store binary data (pictures)
>in a Oracle database.
>For example: I would like to store a "*.gif" picture in the database.
>The gif-picture is in a file on my harddisc. How can I put the picture in
>the database ?
>Do I have access to the picture with ORACLE-FORMS 4.5 ?
>Or: How can I retrieve the picture from the database?
>I am looking for a demo-table, where I can see how it works.
There are two approaches that you may think about. The first is to store the path and filename as a string in the database. When you reference the picture it must go to the location referred to by the database to get the picture.
The second option is to store the whole picture in the database as a row of 'LONG RAW' datatype. This allows up to 2 Gigabytes of binary data but is very difficult to maintain. Most datatypes in Oracle allow one to copy the data from one table to another with a simple 'CREATE TABLE .. AS SELECT columns FROM ...'. But alas, 'LONG RAW' does not.