Hello,
I'm looking for a hint or example to read and if applicable to write clob fields from/to Oracle 10 dbs. Can anyone give me a hint how I must handle clob fields? We use vast 7.5
Regards
Ralf
Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig
| result fromFile querySpec resultCollection sqlString dict connection lobLocator buffer |
"get locator address"
(AbtDatabaseConnectionSpec forDbmClass: AbtOracle10DatabaseManager databaseName: 'orcl') connect.
connection := AbtDbmSystem activeDatabaseConnection.
connection autoCommit: true.
sqlString := 'select * from clob_table where id = 5'.
querySpec := (AbtQuerySpec new) statement: sqlString.
resultCollection := OrderedCollection new.
result := connection resultTableFromQuerySpec: querySpec.
result do: [:eachRow | resultCollection add: eachRow asDictionary ].
dict := resultCollection first.
lobLocator := (dict at: 'DATA') locatorAddress.
buffer := ByteArray new: 200.
buffer := AbtOracleLobBuffer new
writeLobToBuffer: buffer lob: lobLocator connection: connection.
^buffer
"get locator address"
(AbtDatabaseConnectionSpec forDbmClass: AbtOracle10DatabaseManager databaseName: 'orcl') connect.
connection := AbtDbmSystem activeDatabaseConnection.
connection autoCommit: true.
sqlString := 'select * from blob_table where id = 1'.
querySpec := (AbtQuerySpec new) statement: sqlString.
resultCollection := OrderedCollection new.
result := connection resultTableFromQuerySpec: querySpec.
result do: [:eachRow | resultCollection add: eachRow asDictionary ].
dict := resultCollection first.
lobLocator := (dict at: 'DATA') locatorAddress.
"The user chooses a filename and the file is written:"
"open text file and get file size"
filename := CwFileSelectionPrompter new title: 'Output file'; prompt.
toFile := CfsFileDescriptor
open: filename
oflag: CfsConstants::OWRONLY | CfsConstants::OCREAT | CfsConstants::OTRUNC.
toFile isCfsError
ifTrue: [ ^System prompt: toFile message ].
AbtOracleLobBuffer new
writeLobToFile: toFile lob: lobLocator connection: connection
Return to VA Smalltalk 7.0, 7.5 & 8.0
Users browsing this forum: Yahoo [Bot] and 1 guest