'Note that this code fragment assumes an orablob object as the result of a 
'dynaset operation. This object could have been an OUT parameter of a PL/SQL 
'procedure. For more information please refer to chapter 1. There are two ways 
'of reading a lob using  orablob.read or orablob.copytofile

'Using OraBlob.Read mechanism
Dim OraDyn as OraDynaset, OraSound as OraBlob, amount_read%, chunksize%, chunk

chunksize = 32767
set OraDyn = OraDb.CreateDynaset("select * from Multimedia_tab", ORADYN_DEFAULT)
set OraSound = OraDyn.Fields("Sound").Value
OraSound.PollingAmount = OraSound.Size 'Read entire BLOB contents
Do
    amount_read = OraSound.Read(chunk,chunksize) 'chunk returned is a variant of type byte array
    
Loop Until OraSound.Status <> ORALOB_NEED_DATA

'Using OraBlob.CopyToFile mechanism

Set OraDyn = OraDb.CreateDynaset("select * from Multimedia_tab", ORADYN_DEFAULT)
Set OraSound = OraDyn.Fields("Sound").Value

'Read entire BLOB contents
OraSound.CopyToFile "c:\mysound.aud"
