Page 1 of 1

Unable to cast object of type 'System.DBNull' to type 'CoreLab.Oracle.OracleObject'

Posted: Wed 26 Mar 2008 20:30
by kdulaney
I am calling an Oracle Package that returns nested UDT's that conform to an XML schema. It seems to work fine for most data but I have run into an instance with certain data where I receive this error: Unable to cast object of type 'System.DBNull' to type 'CoreLab.Oracle.OracleObject'. Apparently there is a problem converting the returned UDT.

I can call the package using SQL+ and it executes successfully.

Is there any way to debug this to figure out why the OraDirect.Net package throws an error while SQL+ returns data?

Here is the code that makes the call:

Code: Select all

return (OracleObject)package.ExecuteProcedure(OracleFunctionName, col, true)
where col=collection of strongly-typed parameters.

I have downloaded the latest version of OraDirect.Net v4.50.31 - and am using .net framework 2.0.

Thanks[/code]

Posted: Thu 27 Mar 2008 16:00
by Alexey.mdr
Do you use OraDirect .NET “Oracle Package Wizard ”?
If yes, try setting on
-Use Nullable types- in “Choose method and parameter naming style” section of the wizard.

Otherwise, please send me (alexeyman*crlab*com) a small test project to reproduce the problem.

Posted: Wed 02 Apr 2008 20:04
by kdulaney
After spending more time troubleshooting this, it looks like a size limitation on the object being returned. I can change the date range of the data that I am requesting and it gets the month that I thought was breaking. Basically, I can get all my data if I split into two separate calls (two date ranges) but if I combine the date ranges to one range/one call, it fails. That might explain why it works in SQL+ and SQLDeveloper but not in OraDirect. I will be searching the forums now for size limitations. If you know of a limitation, is there anyway to override it?

Thanks.

Posted: Thu 03 Apr 2008 14:59
by Alexey.mdr
Could you post the error and the stacktrace?
Also please send me or post here a block of code that can show the problem
(please include database objects script).