Filling dataset from oracle gives OCI-22053 error

G

Guest

Hi everyone,

I need to be able to create an untyped dataset from some sql using an
OracleDataAdapter. Unfortunately, I am getting problems where the result set
contains a large number of decimal places. I get the exception:

"An unhandled exception of type 'System.Data.OracleClient.OracleException'
occurred in system.data.dll
Additional information: OCI-22053: overflow error"

The problem seems to be that internally when calling Fill, the
OracleDataReader attempts to convert the number it gets into a System.Decimal
but it does not fit.

I do not know what the sql is going to be so I cannot modify it to limit the
values returned to a certain number of decimal places.

Does anyone have any ideas how I can get around this problem?

Thanks,

Jonathan

Code sample:
OracleConnection conn = new OracleConnection("MyDataSource");
OracleCommand cmd = new OracleCommand("select 1/3 from dual");
cmd.Connection = conn;
OracleDataAdapter adapter = new OracleDataAdapter();
adapter.FillError += new FillErrorEventHandler(FillError);
adapter.SelectCommand = cmd;
DataSet ds = new DataSet();
int rowsReturned = adapter.Fill(ds);
 
M

Mark Ashton

When Fill uses OracleDataReader.GetValues, numeric values are converted from
OracleNumber to System.Decimal which has a smaller range and the risk of
overflow. In V1.1 there is no workaround other than to not use Fill and
directly call OracleDataReader.GetOracleValues.

In .Net Framework V2.0, there is a new property on OracleDataAdapter called
ReturnProviderSpecificTypes in which the adapter will create the DataColumn
with OracleNumber instead of System.Decimal.
 
G

Guest

Thanks,

Thanks for the information. It looks like I will have to write my own class
for creating a DataSet via a data reader. It seems somewhat rediculous that
you cannot do something so simple, I would be quite happy to lose the
precision.

Regards,

Jonathan
 
M

Mark Ashton

The other perspective of losing precision to convert an OracleNumber or
Decimal is data corruption.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top