Assume this scenario:
The type TAdress has been created (equal to the example in your documentation http://www.devart.com/dotconnect/oracle ... bject.html). Furthermore a Package with a function has been created:
Code: Select all
FUNCTION countEmployees(adress IN TAdress) RETURN NUMBER;
Code: Select all
Using cm As New Devart.Data.Oracle.OracleCommand
cm.CommandText = "BEGIN :RET := schema.package.countEmployees(:adress); END;"
..
Dim pAdress As New Devart.Data.Oracle.OracleParameter
pAdress.OracleDbType = Devart.Data.Oracle.OracleDbType.Object
pAdress.Direction = ParameterDirection.Input
pAdress.ObjectTypeName = "schema.TAdress"
pAdress.ParameterName = "adress"
pAdress.Value = Me.ToOracleObject(t.Connection)
cm.Parameters.Add(pAdress)
..
cm.ExecuteNonQuery()
End Using
Code: Select all
Public Function ToOracleObject(ByVal connection As FW.Data.Connection) As Devart.Data.Oracle.NativeOracleObject
Dim oracleObjectOci As Devart.Data.Oracle.NativeOracleObject
oracleObjectOci = New Devart.Data.Oracle.NativeOracleObject(OT_NAME, connection.OracleConnection)
'Case1:
'oracleObjectOci("Country") = "123456789012345"
'Case2:
'oracleObjectOci("Country") = "1234567890123456"
Return oracleObjectOci
End Function
With Unicode = true this will work for case 1, but will fail for case 2 and give ORA-21525 Exception. Although Country has a length of 30 (characters) and the value is just 16 characters long.
Is this probably a bug in NativeOracleObject?
I get this behaviour with 6.80.325. I just tested Functions of Packages. I did not test Procedures/Function outside of a package.
Regards,
Matthias