Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Filling dataset from oracle gives OCI-22053 error

208 views
Skip to first unread message

Jonathan

unread,
Aug 15, 2005, 10:29:03 AM8/15/05
to
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);

Mark Ashton

unread,
Aug 15, 2005, 12:19:57 PM8/15/05
to
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.

--
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

"Jonathan" <Jona...@discussions.microsoft.com> wrote in message
news:923E522B-9DD0-4B88...@microsoft.com...

Jonathan

unread,
Aug 15, 2005, 12:39:16 PM8/15/05
to
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

Mark Ashton

unread,
Aug 15, 2005, 7:40:45 PM8/15/05
to
The other perspective of losing precision to convert an OracleNumber or
Decimal is data corruption.

--
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

"Jonathan" <Jona...@discussions.microsoft.com> wrote in message

news:26CCC08F-76B7-4C5C...@microsoft.com...

cabarini

unread,
Sep 9, 2005, 9:34:09 AM9/9/05
to

select round((1/3),3) from dual

Carlos Barini
SOLVE INFO
Brasil


--
cabarini
------------------------------------------------------------------------
cabarini's Profile: http://www.msusenet.com/member.php?userid=5002
View this thread: http://www.msusenet.com/t-1870982784

0 new messages