OraBlob.CopyToFile "blob.bmp" amount,offset,chunksize OraClob.CopyToFile "clob.txt" amount,offset,chunksize OraBfile.CopyToFile "bfile.bmp" amount,offset,chunksize
The arguments for the method are:
| Arguments | Description | 
|---|---|
| [ in]filename | A Stringspecifying the absolute name and path for which the file is to be written. | 
| [ in] [optional]amount | An Integerspecifying the maximum amount to be copied, in bytes forOraBLOB/OraBFILEand characters forOraCLOB. Default value is the size of the LOB orBFILE. | 
| [ in] [optional]offset | An Integerspecifying absolute offset of the LOB orBFILEvalue of this instance, in bytes forOraBLOB/OraBFILEand characters forOraCLOB. Default value is1. | 
| [ in] [optional]chunksize | An Integerspecifying the size, in bytes, for each write operation. If thechunksizeparameter is not set or is0, the value of theamountargument is used which means the entire amount is transferred in one chunk. | 
The file is in the same format as the NLS_LANG setting.
If the file exists, its contents is overwritten.
Example:Using the CopyToFile Method
This example demonstrates the use of the CopyToFile method.
Be sure that you have the PART table in the database with valid LOB data in it. Also, be sure that you have installed the OraLOB Schema Objects as described in "Schema Objects Used in LOB Data Type Examples" .
Dim OraSession As OraSession 
Dim OraDatabase As OraDatabase 
Dim PartDesc as OraCLOB 
 
'Create the OraSession Object. 
Set OraSession = CreateObject("OracleInProcServer.XOraSession") 
 
'Create the OraDatabase Object by opening a connection to Oracle. 
Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&
 
'Create a Dynaset containing a BLOB and a CLOB column 
set part = OraDatabase.CreateDynaset ("select * from part where" & _
                "part_id = 1234",0) 
set PartDesc = part.Fields("part_desc").Value 
 
'Copy the entire LOB content to partdesc.txt file 
PartDesc.CopyToFile "partdesc.txt"