Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to save a BLOB to a file on disk in PL/SQL
In article <y0dZ9.130423$sV3.4961522_at_news3.calgary.shaw.ca>, "zorro" says...
>
>I want to do it in PL/SQL, not in Java, Thanks.
can only be done in 9ir2 (and you gave no version information whatsoever...)
and can be done as Rauf said there -- with utl_file
>
>"Rauf Sarwar" <rs_arwar_at_hotmail.com> wrote in message
>news:92eeeff0.0301270727.7d771a77_at_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
>
>
-- Thomas Kyte (tkyte@oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Mon Jan 27 2003 - 11:43:02 CST
![]() |
![]() |