Oracle Objects for OLE
Release 9.2

Part Number A95895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Example: Single piece Write of a LOB

Schema Description

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim PartImage As OraBlob

Dim buffer() As Byte

'Create the OraSession Object.

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

'Create the OraDatabase Object.

Set OraDatabase = OraSession.OpenDatabase("ExampleDb",

"scott/tiger", 0&)

'Add PartDesc as an Output parameter and set its initial value.

OraDatabase.Parameters.Add "PartImage", Null, ORAPARM_OUTPUT

OraDatabase.Parameters("PartImage").ServerType = ORATYPE_BLOB

'Begin the transaction

OraSession.BeginTrans

'Execute the statement returning 'PartDesc'

OraDatabase.ExecuteSQL ("BEGIN select part_image into :PARTIMAGE

from part where part_id = 1

for update NOWAIT; END;")

'Get 'PartDesc' from Parameters collection

Set PartImage = OraDatabase.Parameters("PartImage").Value

'Get a free file number

FNum = FreeFile

'Open the file.

Open "PartImage.Dat" For Binary As #FNum

'Re adjust the buffer size to hold entire file data

ReDim buffer(LOF(FNum))

Get #FNum, , buffer

'Do one write operation

amount_written = PartImage.Write(buffer)

Close FNum

MsgBox "Amount written to the LOB data is " & amount_written

'Ends the transaction

OraSession.CommitTrans


 
Oracle
Copyright © 1994, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback