Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oci to sql conversion?
Just to be complete, this is what I came up with. It is VB6 code, and
it works ;)
Volker, it is mostly based on what you said. As you might see, I get the sdo_elem_info collection, but what does these values mean? One of my results is (1, 2, 1)... Anyway. Thanks for your help :)
Pieter
Private Sub Command_Click()
Log.Clear
Set mGeometries = New Collector
' connect to oracle
Dim oraSession As New OracleInProcServer.OraSessionClass
Dim userSession As OracleInProcServer.OraDatabase
Set userSession = oraSession.OpenDatabase("aubis", "aubis/aubis",
0)
userSession.AutoCommit = False
'MsgBox "Connected: " & vbNewLine _' & vbNewLine & "0040VER=" & oraSession.OipVersionNumber _
' & userSession.Connect & "@" & userSession.DatabaseName _
' do the query
Dim dynaSet As OracleInProcServer.OraDynaset
Set dynaSet = userSession.CreateDynaset("SELECT clast_id, geometry
FROM map_clasts", 0&)
' vars
Dim result As String
Dim counter As Integer
Dim ob As OracleInProcServer.OraObject Dim info As OracleInProcServer.OraCollection Dim Oords As OracleInProcServer.OraCollection
Dim theGeometry As geometry
Dim theCoordinate As coordinate
Do While (dynaSet.EOF = False)
'get at the geometry Set ob = dynaSet.Fields("geometry").value Set info = ob.sdo_elem_info Set Oords = ob.sdo_ordinates ' make the geometry Set theGeometry =
' populate its ordinates For counter = 1 To Oords.Size Step 3 Set theCoordinate = New coordinate theCoordinate.X = Oords(counter) theCoordinate.Y = Oords(counter + 1) theCoordinate.Z = Oords(counter + 2) theGeometry.AddCoordinate theCoordinate Next counter ' make result string result = vbNullString 'result = result & ", " & dynaSet.Fields("geometry") ' add to listbox Log.AddItem result 'move cursor one on dynaSet.MoveNext
' report success
MsgBox "Received " & Log.ListCount & " result rows"
' close all of this stuff
dynaSet.Close
userSession.Close
Set oraSession = Nothing
End Sub Received on Fri May 05 2006 - 06:23:44 CDT