Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UDT creation in vb.net. Collection Types and Object Types

889961Sep 22 2011 — edited Sep 22 2011
I have an issue that I would greatly appreciate some insight. Basically I need to model a nested oracle object/collection in a .net object with IOracleCustomType that is using both oracle object types and oracle collection types. Say i have the following in oracle:

create type objRequest as object(
offers offerList
)

create type offerList as table of objOffer

create type objOffer as object(
value varchar(64)
type varchar(64)
)

My question is how do I model the "as table of type"? When i created it as an object I can't assign the objOffer to it because there are no attributes for offerList. I have all three objects set up like the below .net code but I'm guessing that the "as table of" needs to be represented differently. Any insight is greatly appreciated.

Public Class CREDITRATINGTYPE : Implements INullable, IOracleCustomType

Private m_Isnull As Boolean
Private m_VALUE As Int16
Private m_TYPE As String

Public ReadOnly Property IsNull As Boolean Implements Oracle.DataAccess.Types.INullable.IsNull
Get
Return Me.m_Isnull
End Get
End Property

Public Shared Property Null As CREDITRATINGTYPE
Get
Dim obj As CREDITRATINGTYPE = New CREDITRATINGTYPE
obj.m_Isnull = True
Return obj
End Get
Set(value As CREDITRATINGTYPE)

End Set
End Property

<OracleObjectMappingAttribute("VALUE")>
Public Property VALUE As Int16
Get
Return Me.m_VALUE
End Get
Set(value As Int16)
Me.m_VALUE = value
End Set
End Property

<OracleObjectMappingAttribute("TYPE")>
Public Property TYPE As String
Get
Return Me.m_TYPE
End Get
Set(value As String)
Me.m_TYPE = value
End Set
End Property

Public Sub FromCustomObject(con As Oracle.DataAccess.Client.OracleConnection, pUdt As System.IntPtr) Implements Oracle.DataAccess.Types.IOracleCustomType.FromCustomObject
OracleUdt.SetValue(con, pUdt, "VALUE", Me.VALUE)
OracleUdt.SetValue(con, pUdt, "TYPE", Me.TYPE)
End Sub

Public Sub ToCustomObject(con As Oracle.DataAccess.Client.OracleConnection, pUdt As System.IntPtr) Implements Oracle.DataAccess.Types.IOracleCustomType.ToCustomObject
Me.VALUE = OracleUdt.GetValue(con, pUdt, "VALUE")
Me.TYPE = OracleUdt.GetValue(con, pUdt, "TYPE")
End Sub
End Class

<OracleCustomTypeMappingAttribute("CREDITRATINGTYPE")>
Public Class CreditRatingTypeFactory : Implements IOracleCustomTypeFactory

Public Function CreateObject() As Oracle.DataAccess.Types.IOracleCustomType Implements Oracle.DataAccess.Types.IOracleCustomTypeFactory.CreateObject
Dim obj = New CREDITRATINGTYPE
Return obj
End Function
End Class

Edited by: 886958 on Sep 22, 2011 3:25 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 20 2011
Added on Sep 22 2011
0 comments
551 views