----- Original Message -----
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 23:40


> I have a wav file and I have to insert it into a table with column blob
> type.
> How do I do this.
>

If u're working with JDBC then u should just open the OutputStream of the
BLOB and write content from the .wav file's InputStream there.


If u want to do it only with the help of the DBMS_LOB package then you could
take a look in the docs in the "Oracle8i
Application Developer's Guide - Large Objects (LOBs) "  chapter. There is an
example for reading a file and storing the content into a BLOB that looks
like :

/* 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;


Of course u should read the docs for details about the example (especially
for details about CREATE DIRECTORY, BFILE, EMPTY_BLOB()).


hth,

    Marin

----
"When someone is seeking, it happens quite easily that he only sees
the thing that he is seeking; that he is unable to find anything, unable to
absorb anything, because he is only thinking of the thing he is seeking,
because he is obsessed with his goal. Seeking means: to have a goal;
but finding means: to be free, to be receptive, to have no goal. ..."


                                Herman Hesse, "Siddhartha"






-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Marin Dimitrov
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to