oracle / dotnet-db-samples

.NET code samples for Oracle database developers #OracleDotNet
http://otn.oracle.com/dotnet
MIT License
408 stars 190 forks source link

Help passing UDT object to stored procedure #294

Closed gpgpublickey closed 1 year ago

gpgpublickey commented 1 year ago

I have defined a stored procedure: PROCEDURE FOO(v_foo_obj IN OUT MY_FOO_OBJ); And its corresponding body.

The MY_FOO_OBJ has a FOO_PROPERTY NUMBER(3,0) NULL

I followed the steps from the udt object example, i created the class mapping the object using the oracle visual studio creation wizard.

But I'm getting this error: The_namespaces_in_my_project.MY_FOO_OBJ::FOO_PROPERTY::OracleObjectMappingAttribute' cannot be set to an invalid value of 'FOO_PROPERTY'

Any clue, idea to identify why that error happens?

Thx

alexkeh commented 1 year ago

I believe the Oracle Developer Tools for VS UDT wizard still uses unmanaged ODP.NET libraries. It doesn't use managed ODP.NET yet. @christianshay is that right?

If so, then you'll need to modify the custom UDT code to use managed ODP.NET (or ODP.NET Core). The differences between unmanaged ODP.NET UDTs and the other two providers' UDT support is documented here.

Click here if you're looking for managed/core ODP.NET UDT sample code.

gpgpublickey commented 1 year ago

Thanks and solved, the issue was in my code, I was using a wrapper to convert from records to objects and I forgot to create the body for the udt object to put the constructor implementation. That solved the issue