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 15:39:15 -0800
Message-ID: <92eeeff0.0301271539.359fb042_at_posting.google.com>


"zorro" <z_at_z.com> wrote in message news:<y0dZ9.130423$sV3.4961522_at_news3.calgary.shaw.ca>... > I want to do it in PL/SQL, not in Java, Thanks.

I did not realize this before.... please DO NOT CROSSPOST to every Oracle group that you can spell.

If you are on 9i then you can use plsql as described in step 1.

> > 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.

If you are on pre 9i then you have no choice but to use java as described in step 2 or upgrade to 9i.

> > 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 Tue Jan 28 2003 - 00:39:15 CET

Original text of this message