Oracle Objects for OLE
Release 9.0.1

Part Number A90173-01

Home

Book List

Contents

Master Index

Feedback

Example: Single piece Reading of a LOB

Schema Description

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim PartDesc As OraClob

Dim AmountRead As Long

Dim buffer As Variant

Dim buf As String

'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 "PartDesc", Null, ORAPARM_OUTPUT

OraDatabase.Parameters("PartDesc").ServerType = ORATYPE_CLOB

'Execute the statement returning 'PartDesc'

OraDatabase.ExecuteSQL ("BEGIN select part_desc into :PARTDESC from

part where part_id = 1 for update NOWAIT; END;")

'Get 'PartDesc' from Parameters collection

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

'Get a free file number

FNum = FreeFile

'Open the file.

Open "Desc.Dat" For Binary As #FNum

'Read entire CLOB value, buffer must be a Variant

AmountRead = PartDesc.Read(buffer)

'put will not allow Variant type

buf = buffer

Put #FNum, , buf

Close FNum


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents