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: Dynasets Containing LOBs and Transactions

Schema Description

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim PartImage as OraBLOB

Dim ImageChunk() As Byte

Dim amount_written As Long

'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 PartImage = part.Fields("part_image").Value

'Open the file for reading PartImages

Open "c:\part_picture.gif" For Binary As #FNum

Redim ImageChunk(LOF(FNum))

'read the file and put it into buffer

Get #FNum, , ImageChunk

'starts the transaction on OraSession

OraSession.BeginTrans

'call dynaset's Edit method to lock the row

part.Edit

amount_written = OraBlob.Write(ImageChunk)

part.Update

'ends the transaction

OraSession.EndTrans

'the following lines of code will raise error

'LOB locator cannot span transaction'

msgbox Partimage.Size

Close FNum


 
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