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

Home -> Community -> Usenet -> c.d.o.server -> Re: BLOB, CLOB

Re: BLOB, CLOB

From: Niall Litchfield <niall.litchfield_at_dial.pipex.com>
Date: Mon, 6 May 2002 12:35:17 +0100
Message-ID: <3cd66a78$0$8511$cc9e4d1f@news.dial.pipex.com>


I should also mention that an approach for the OP might be to expand upon the procedure below (taken from the 9i docs) to prodcue a generic lob loading routine.
Loading a LOB with Data from a BFILE
This script is also located at $ORACLE_HOME/rdbms/demo/lobs/pls/iloaddat.

/* Note that the example procedure loadLOBFromBFILE_proc is not part of the

   DBMS_LOB package: */
CREATE OR REPLACE PROCEDURE loadLOBFromBFILE_proc IS

   Dest_loc       BLOB;
   Src_loc        BFILE := BFILENAME('FRAME_DIR', 'Washington_frame');
   Amount         INTEGER := 4000;

BEGIN
   SELECT Frame INTO Dest_loc FROM Multimedia_tab

      WHERE Clip_ID = 3 FOR UPDATE;
   /* Opening the source BFILE is mandatory: */    DBMS_LOB.OPEN(Src_loc, DBMS_LOB.LOB_READONLY);    /* Opening the LOB is optional: */
   DBMS_LOB.OPEN(Dest_loc, DBMS_LOB.LOB_READWRITE);    DBMS_LOB.LOADFROMFILE(Dest_loc, Src_loc, Amount);    /* Closing the LOB is mandatory if you have opened it: */    DBMS_LOB.CLOSE(Dest_loc);
   DBMS_LOB.CLOSE(Src_loc);
   COMMIT;
END;

--
Niall Litchfield
Oracle DBA
Audit Commission UK
"Niall Litchfield" <niall.litchfield_at_dial.pipex.com> wrote in message
news:3cd66840$0$8512$cc9e4d1f_at_news.dial.pipex.com...

> "Daniel A. Morgan" <damorgan_at_exesolutions.com> wrote in message
> news:3CD5318E.B08C61CE_at_exesolutions.com...
> > Niall Litchfield wrote:
> >
> > > look into dbms_lob which will allow you to do this .
> > >
> > > --
> > > Niall Litchfield
> > > Oracle DBA
> > > Audit Commission UK
> > > "Simon Walchshofer" <simon.walchshofer_at_students.uni-linz.ac.at> wrote
in
> > > message news:3cd530d1_at_news.uni-linz.ac.at...
> > > > Hi!
> > > >
> > > > Is it possible to insert for example a picture into a table with one
> > > > sql-insert statement?
> > > >
> > > > e.g.
> > > > create table myLob (id number, picture clob);
> > > >
> > > > insert into myLob values (1, ??????????);
> > > >
> > > > Is there a possibility to specify the file-path directly in the
> > > > insert-statement??
> > > >
> > > > THX
> > > > Simon
> > > >
> > > >
> >
> > Please correct me if I am wrong but it is not possible, DBMS_LOB, or
not.
> > Every time I have gotten it to work I have inserted a row with an
> > EMPTY_BLOB() reutrning ROWID and then locked it then updated it with the
> > image.
>
> sorry you are correct (AFAIK) and I am wrong. you do need the lob locator
> before you insert.
> >
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> >
Received on Mon May 06 2002 - 06:35:17 CDT

Original text of this message

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