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: How to save a BLOB to a file on disk in PL/SQL

Re: How to save a BLOB to a file on disk in PL/SQL

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 27 Jan 2003 07:27:26 -0800
Message-ID: <92eeeff0.0301270727.7d771a77@posting.google.com>


"zorro" <z_at_z.com> wrote in message news:<BZ6Z9.129790$H7.5248099_at_news2.calgary.shaw.ca>...
> Hi,
>
> I know how to load a binary file into a BLOB column, but I'd like to do the
> opposite now and create a file on disk with the data from a BLOB column.
>
> Anybody can help ?
>
> Thank you,
> Denis

  1. Use dbms_lob and utl_file packages. You should be able to open an io stream by getting RAW data from BLOB column by using dbms_lob.read and output to a file using utl_file.Put_Raw, theorectically because I have not tested it myself.
  2. Use java.sql and java.io api's and write a java stored procedure. There are functions in java.sql to get to BLOB data. Look at java.sql.Blob and java.sql.ResultSet.getBlob(). Once you get the handle to InputStream from java.sql.Blob, you can use java.io.FileOutputStream and write data to file.

Regards
/Rauf Sarwar Received on Mon Jan 27 2003 - 09:27:26 CST

Original text of this message

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