Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: oci to sql conversion?

Re: oci to sql conversion?

From: pieter <pieter.breed_at_gmail.com>
Date: 5 May 2006 04:23:44 -0700
Message-ID: <1146828224.874389.48100@i39g2000cwa.googlegroups.com>


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 _

' & userSession.Connect & "@" & userSession.DatabaseName _
' & vbNewLine & "0040VER=" & oraSession.OipVersionNumber _
' & vbNewLine & "Oracle Version: " & vbNewLine &
userSession.RDBMSVersion

' 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 =

mGeometries.AddNewGeometry(CLng(dynaSet("clast_id")))
        ' 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

    Loop

' 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US