OracleDataAdapter.Fill() causes System.OverflowException on certain numbers

This test shows how a value calculated in the database and stored in a column of type "number" (default scale/precision) causes an error upon retrieval using the OradleDataAdapter.Fill() method. The data type of the receiving column is irrelevant. The following example uses a decimal, but double, float, int, etc... all cause the same System.OverflowException error.
Does anyone have a good suggestion of how to best handle this problem?
I am using ODP.NET 9.2.0.4.0 (OraWin9204.exe) with Oracle9i (9.2.0.4.0) running both client and server on Windows 2000, using Visual Studio 2003.
<code>
/// <summary>
/// The following test illustrates how a value that was calculated in the database
/// causes an overflow error when retreiving it using the Oracle.DataAccess.Client
/// </summary>
public void ODP_CalculatedNumberIntoDecimalOverflowError()
     using (OracleConnection conn = new OracleConnection(CONNECT_STRING))
          conn.Open();
          try
               using (IDbCommand createCmd = conn.CreateCommand())
                    createCmd.CommandText = "create table overflow_test (num number)";
                    createCmd.ExecuteNonQuery();
               using (IDbCommand insertCmd = conn.CreateCommand())
                    insertCmd.CommandText = "insert into overflow_test (num) values (61 / 3)";
                    insertCmd.ExecuteNonQuery();
               using (OracleCommand selectCmd = conn.CreateCommand())
                    selectCmd.CommandText = "select * from overflow_test";
                    DataTable overflowTest = new DataTable("overflow_test");
                    DataColumn num = new DataColumn("num", typeof (decimal));
                    overflowTest.Columns.Add(num);
                    OracleDataAdapter oda = new OracleDataAdapter(selectCmd);
                    oda.Fill(overflowTest);
                    int i = 0;
                    foreach (DataRow row in table.Rows)
                         Console.Out.Write("Row[{0}]:", i);
                         for (int j = 0; j < row.Table.Columns.Count; j++)
                              Console.Out.Write(" {0}", row[j]);
                         Console.Out.WriteLine();
                         i++;
          finally
               using (IDbCommand deleteCmd = conn.CreateCommand())
                    deleteCmd.CommandText = "drop table overflow_test";
                    deleteCmd.ExecuteNonQuery();
</code>

The problem is even worse: it also happens with aggregate functions like AVG
CREATE Table Test (
Value NUMBER(10,0)
INSERT INTO Test VALUES (20);
INSERT INTO Test VALUES (20);
INSERT INTO Test VALUES (21)
SELECT AVG(Value) from Test
Adding the SafeMapping means we have to adjust our code to expect string values instead of decimals
The other workaround: (use ROUND or TRUNC) means we have to adjust all Sql statements!
Please solve this bug in the ODP.NET client, i.e. create a way to get normal .NET native type values into a DataSet. (oda.TruncateDecimals = true?)

Similar Messages

  • OracleDataAdapter.fill cause ArgumentOutOfRangeException

    We have data that is saved by a Oracle Forms application. This data includes a Date field for the time the data was last saved. If I try to read this data into a DataTable, a call to the OracleDataAdapter.Fill method causes an ArgumentOutOfRangeException.
    "Year, Month, and Day parameters describe an un-representable DateTime."
    at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
    at System.DateTime..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second)
    at Oracle.DataAccess.Client.OracleDataReader.GetValue(Object[] values)
    Looking at the data with Oracle Developer I noticed something interesting. The raw view of the date saved from the Forms app differs from a date saved from Developer or a .NET app.
    select dump(savedate), to_char(savedate, 'ddmmyyyy hh24miss') from xxxTable;
    Typ=12 Len=7: 80,86,1,9,17,13,4          09012014 161203
    Typ=12 Len=7: 120,114,1,9,17,13,4     09012014 161203
    The former is a date saved from the Forms app. The latter is a date saved from Developer/.NET app. Yet Developer seems to know how to format both. Is this a bug in the database, or in the OracleDataAdapter or in Oracle Forms, or in our code?
    Oracle.DataAccess.dll     v.2.102.2.20

    Well, turns out the erroneous date have a negative year, i.e. BC. I referred this to our Oracle Forms devs.
    The way Oracle stores date internally is like this.
    Jan. 1st, 2014 16:12:03
    Typ=12 Len=7: 120,114,1,9,17,13,4     09012014 161203
    120 - 100 = 20
    114 - 100 = 14
    ==> year 2014
    1 ==> January
    9 ==> 1st
    17 - 1 = 16
    13 - 1 = 12
    4 - 1 = 03
    If you do the same to the erroneous date, the year is negative.
    80 - 100 = -20
    86 - 100 = -14
    ==> -2014 or 2014 BC
    I consider it a bit of a faux-pas that Oracle Developer's default formatting doesn't use SYYYY (S being the negative/positive sign).
    EDIT.
    You can also change the date formatting in Oracle Developer from Tools > Preferences > Database > NLS.

  • OracleDataAdapter.Fill returns incorrect data for small numbers.

    Hi All,
    Recently we moved to Oracle client 11.1.0.7.20 with ODP.NET and instant client.
    And we encountered the following issue.
    When FetchSize of the command is set to any value that differs from default for some number fields with size <5 incorrect values are returned.
    I used the following code to reproduce the issue:
    var query = "SELECT * FROM RT ORDER BY ID";
    var connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=1531)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test)));User Id=user;Password=password;";
    var column = "IS_LEAF"; // data type is NUMBER(1, 0)
    using (var connection = new OracleConnection(connectionString))
    using (var cmd1 = connection.CreateCommand())
    using (var cmd2 = connection.CreateCommand())
    cmd1.CommandText = query;
    cmd2.CommandText = query;
    cmd2.FetchSize = 512*1024; // 512K
    var adapter1 = new OracleDataAdapter(cmd1);
    var table1 = new DataTable();
    adapter1.Fill(table1);
    var adapter2 = new OracleDataAdapter(cmd2);
    var table2 = new DataTable();
    adapter2.Fill(table2);
    for (int i = 0; i < table1.Rows.Count; i++)
    var row1 = table1.Rows;
    var row2 = table2.Rows[i];
    if (!object.Equals(row1[column], row2[column]))
    Console.WriteLine(string.Format("values don't match: {0}, {1}", row1[column], row2[column]));
    there are some ouput lines:
    values don't match: 0, 3328
    values don't match: 0, 3
    values don't match: 1, 3
    values don't match: 0, 318
    values don't match: 0, 264
    values don't match: 1, 10280
    values don't match: 1, 842
    values don't match: 1, 7184
    The column type is NUMBER(1, 0) and only values in the database are 1 or 0. So as you can see most of the values filled with custom fetch size are totally incorrect.
    We have several tables with small number fields and for some of them the issue reproduces but for others does not.
    And the issue doesn't appear:
    1. with Oracle client 11.1.0.6.20
    2. if I use data readers and compare values record by record.
    Our Oracle DB version is 10.2.0.4.
    Thanks,
    Maxim.

    For anyone that may find this at a later time, this behavior has now been corrected, and is available in 11107 Patch 31 and newer, available on My Oracle Support. Note that the "self tuning=false" did not work in all cases, so the only reliable solution is to get the patch.
    Greg

  • System.OverflowException in OracleDataReader.GetDecimal

    The following code
    Dim conn As OracleConnection = ...
    Dim ssql As String = "select to_date('2003-04-21 09.54','YYYY-MM-DD HH.SS') - to_date('2003-04-21 09.57','YYYY-MM-DD HH.SS') foo from dual"
    Dim cmd As New OracleCommand(ssql, conn)
    Dim dr As OracleDataReader = cmd.ExecuteReader
    dr.read
    Dim val As Object = dr(0)
    results in the following exception
    System.OverflowException: Arithmetic operation resulted in an overflow.
    at Oracle.DataAccess.Types.DecimalConv.GetDecimal(IntPtr numCtx)
    at Oracle.DataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
    at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
    at Oracle.DataAccess.Client.OracleDataReader.get_Item
    David

    Of course!
    Thanks,
    But that means that this query will behave the same way:
    "select 1/3 from dual".
    And so almost any calculation executed by the ORACLE could sporatically generate an OverflowException.
    This seems to contradict the behavior indicated in the ODP.NET docs:
    "Potential Data Loss
    The following sections provide more detail about the types and circumstances
    where data can be lost.
    Oracle NUMBER Type to .NET Decimal Type
    The Oracle datatype NUMBER can hold up to 38 precisions whereas .NET Decimal
    type can hold up to 28 precisions. If a NUMBER datatype that has more than 28
    precisions is retrieved into .NET decimal type, it loses precision."
    It says that the data will loose precision, not throw an OverflowException.
    The real kicker (and the way I found this) is not in directly accessing the datareader, but rather in the OracleDataAdapter. OracleDataAdapter.fill, at least, should truncate the NUMBER without complaint.
    David

  • Only receive texts from certain numbers

    Aside from having the absolute worst customer support of the various phone services I've used ( I was seriously on the phone for 45 minutes trying various ways to get through the machine to get to a customer service rep. Continuously said, "Sorry we couldn't help you, goodbye." or, "We couldn't connect your call". ) I can no longer receive texts from certain numbers.
    I can send texts and people receive them. I can receive texts back from some of these people, however when others try to text me it goes instead to a random person. (Which seems to be the same person their texts are getting forwarded to each time. )
    I've turned off the call forwarding with *73, I've updated my software, I've TRIED to get in touch with a customer service representative about my account, but that's seemingly impossible.
    Offer me a suggestion or don't. This is my last month with Verizon no matter what. Inconvenience on top of inconvenience on top of inconvenience.

        Having text message work properly is very important. I'm sorry you are having so many issues with your service and that you have not been able to contact customer service. You can reach us at *611 or 1-800-922-0204 and hit 0 to speak to a representative. You can also send us a private message with your name and phone number so that we can call you and take a look at the account in detail. What phone do you have and are you using a 3rd party text messaging application?
    KinquanaH_VZW
    Follow us on Twitter @vzwsupport

  • I have found an issue with MS13-098 which causes systems to be renamed to MINWINPC

    I have found an issue with MS13-098 which causes systems to be renamed to  MINWINPC.  The issue has been reported in Japanese by Microsoft. The translation is:
    Phenomenon
      In Windows Server 2008 or Windows Vista, you might not be able to log an error appears to apply the new update the following programs, if you try to log on after the restart. •  MS12-024 (KB2653956)
    •  MS13-098 (KB2893294)
     Error message displayed is as follows.
     Incorrect password or user name
      Back to the top | feedback
    Collapse image  Cause
      This behavior occurs when you apply the update KB2653956 in the state of some data is damaged following registry key, or does not exist.
     HKEY_LOCAL_MACHINE \ SCHEMA \ wcm :/ / Microsoft-Windows-CoreOS? ...
     Any string will contain the part of the ... Note:.  Also, make sure to load the SystemRoot% \ system32 \ SMI \ Store \ Machine \ SCHEMA.DAT file% if the HKEY_LOCAL_MACHINE \ SCHEMA does not exist.
     When you apply the update of KB2653956 in the state where the registry key is not present, the value of the following registry is changed to MINWINPC, logon will not be able to.
    •  HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName \ ActiveComputerName
    •  HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName \ ComputerName
      Back to the top | feedback
    Collapse image  Solution
      If this occurs, change to the correct computer name the value of the ComputerName registry and ActiveComputerName start in safe mode, has been mentioned above, and then restart.
      Back to the top | feedback
    Collapse image  Workaround
      To prevent this phenomenon occurs, you download and run the System Update Readiness Tool from the following KB.
     http://support.microsoft.com/kb/947821
     By performing the system update Preparation tool registry that is described in Section Symptoms are repaired.
     If the repair is made, starting with log Recreated missing key as the following WinDir% \ Logs \ CBS \ CheckSUR.log file% is recorded.
     Recreated missing key:? Wcm :/ / Microsoft-Windows-CoreOS ... \ metadata \ elements \ ComputerName
     In addition, regardless of the presence or absence of entry damaged Microsoft-Windows-CoreOS, you can set the value of the ComputerName key in this tool.  For this reason, the following log is recorded in the CheckSUR.log.
     Recreated value: @ _type.
     Recreated value: @ dataOnly.
     Recreated value: @ default.
     Recreated value: @ description.
     Recreated value: @ displayName.
     Recreated value: @ handler.
     Recreated value: @ legacyName.
     Recreated value: @ legacyType.
     Recreated value: @ migrate.
     Recreated value: @ scope.
     Recreated value: @ xsd: type.
      Back to the top | feedback
     Note: This is a "FAST PUBLISH" article created directly from within the Microsoft support organization.  It contains information in response to emerging issues are listed.  As a result of the speed of information provided may be
    typographical errors are included in the article, you might be revised at any time without prior notice.  For other considerations, and use conditions
     Please refer to.
      Back to the top | feedback
    Collapse image  Property
      December 11, 2013 - Revision: - Last Review: 2901584: 4.0 Document Number
      This document that was written about products for.
    •  Windows Vista Business
    •  Windows Vista Business 64-bit edition
    •  Windows Vista Enterprise
    •  Windows Vista Enterprise 64-bit edition
    •  Windows Vista Home Basic
    •  Windows Vista Home Basic 64-bit edition
    •  Windows Vista Home Premium
    •  Windows Vista Home Premium 64-bit edition
    •  Windows Vista Starter
    •  Windows Vista Ultimate
    •  Windows Vista Ultimate 64-bit edition
    •  Windows Server 2008 Datacenter
    •  Windows Server 2008 Datacenter without Hyper-V
    •  Windows Server 2008 Enterprise
    •  Windows Server 2008 Enterprise without Hyper-V
    •  Windows Server 2008 for Itanium-Based Systems
    •  Windows Server 2008 Foundation
    •  Windows Server 2008 Standard
    •  Windows Server 2008 Standard without Hyper-V
    •  Windows Web Server 2008
    •  Windows HPC Server 2008
    •  Windows Essential Business Server 2008
    We are having the issue on hundreds of systems and I am rolling out the readiness tool mentioned above to prevent other systems from being affected.  In the mean time I have stopped deploying MS13-098 and am hoping Microsoft will go ahead and let all
    of their customers know about the problem instead of just one country.  Hopefully the original bulletin will be updated with this known issue.

    PPoj,
    Apple has offered replacement or pro-rated refunds in the US as a settlement of a class action lawsuit, not because of pride in their design-centric approach to their products. If you seek a similar replacement/refund program in India, then the odds are pretty good that you’d need a similar legal approach with which to convince Apple to offer a similar program there. If you’re unwilling to wait for such an event, then you can purchase a replacement power cable now, and hope for a pro-rated refund at some point in the future.

  • Windows 7 64bit with ODBC 11.2.0.1.0 - Exception: System.OverflowException

    Hello,
    Please help. I developed an interface between a CAD and Oracle 10g 32bit on Windows Server 2003. I have no problems with the using of the ODBC driver (Instant Client Package - ODBC (instantclient-odbc-win-x86-64-10.2.0.3.0.zip) on Windows XP 32bit and Windows XP 64bit.
    If I try to use 64bit ODBC driver (Instant Client Package - ODBC (instantclient-odbc-win-x86-64-11.2.0.1.0.zip) on Windows 7 64bit with the Oracle DB 10g 32bit on Windows Server 2003, I receive the following message after the line with OraRead = OraComm.ExecuteReader:
    Exception: System.OverflowException: Die arithmetische Operation hat einen Überlauf verursacht.
    bei System.Data.Odbc.OdbcStatementHandle.RowCount(SQLLEN& rowCount)
    bei System.Data.Odbc.OdbcDataReader.GetRowCount()
    bei System.Data.Odbc.OdbcDataReader.FirstResult()
    bei System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
    bei System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
    bei System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
    The code I use is very simple:
    Dim sConnection = "DRIVER=Oracle in instantclient_11_2;UID=xx;DBQ=xx;SERVER=xx;Pwd=xx"
    Dim strSQL As String
    Dim OraConn As New System.Data.Odbc.OdbcConnection
    Dim OraComm As New System.Data.Odbc.OdbcCommand
    Dim OraRead As System.Data.Odbc.OdbcDataReader
    Try
         OraConn.ConnectionString = sConnection
         OraConn.Open()
         strSQL = "SELECT * FROM TAB"
    OraComm.CommandText = strSQL
    OraComm.Connection = OraConn
    OraRead = OraComm.ExecuteReader
    If OraRead.HasRows Then
         OraRead.Read()
    The test connection from the ODBC admin tool return ok.
    Any help will be apricable.
    Regards,
    Hristo

    I'm having the same problem. Did you ever find a solution for this?
    For reference, my question is located over here: OverFlowException on Oracle ODBC RowCount

  • IN NUMBERS HOW DO YOU FILL IN FOR A SERIES OF NUMBERS OR DATES

    In numbers how do you fill in for a series of numbers or dates without doing it manually

    You can enter a value in two cells that establishes a pattern, then select the two cells, then click (and hold) on the little circle at the bottom right corner of the selection and drag to fill as needed.
    A Number sequence:
    A Date sequence:

  • I have an iPhone 5c. Just started having trouble texting to certain numbers. I send a message, they receive it (most of the time) but it also comes back to me saying not delivered. Also, their texts to me are delayed, sometimes 4hours and sometimes more?!

    I have an iPhone 5c. Just started having trouble texting certain numbers. They receive them(most of them) but then it comes back to me saying not delivered. Also, their texts to me are delayed, anywhere from 4 to 12 hours.

    iMessages. I have gone into settings and turned off iMessages for one minute then reactivated it. Then I turned off network settings and then back on again. Today I'll try and restore the phone again to see if that works. Frustrating!

  • Certain Numbers templets allow you to drag and drop contacts to populate cell data, how can I create that functionality in my own tables?

    Certain Numbers templets allow you to drag and drop contacts to populate cell data, how can I create that functionality in my own tables?

    If you haven't come across the workarounds thread you may find helpful tips there on this and other ways to work with Numbers 3.
    ronniefromcalifornia discovered how to bring contacts into Numbers 3. As described in this post:
    "Open Contacts
    Select all the cards you want
    Copy
    In Numbers, in a table, select cell A1
    Paste
    Boom. Works great. Even brought in the pictures. Cool."
    So instead of drag and drop, just select in Contacts, copy, and paste into Numbers
    SG

  • ITunes Causing System Freezes

    After playing a CD or listening to my music library for a while, I get random freezes; eg spinning beachball in iTunes. It happens when an album is finished or a playlist is finished and I go back to iTunes to eject or quit or play a new playlist. Freezes. When I try to click Apple (in order to click on Force Quit), it isn't available...the beachball rules. The only thing I can do with the cursor is click on Finder in the Dock; or the desktop area outside of open apps. Cmnd+Q doesn't work. Cmnd+esc doesn't work. CmndoptnQ doesn't work. Cmndoptnesc brings up the force quit dialogue. That leads to a "force finder to quit?" dialogue. A couple times I've had to resort to hard rebooting.
    Suggestions would be appreciated; but another issue is the fact that this is causing system freezes and I was under the impression that the cool thing about OS X is that one app won't cause system freezes.
    There's another similar thread titled 'it crashes', but system freezes aren't mentioned.
    Any ideas?

    Still doing it...but I give up on getting any help.

  • Is there a way to block certain numbers from iMessaging?

    Is there a way to block certain numbers from iMessages, such as Smart limits with AT&T?

    Sorry, no.

  • Want to be able to block certain numbers and texts on my phone

    been trying to add a block call and text from certain numbers feature on my phone but i havent been able to do so.....do i need to call Verizon to add that or is there a link that i havent found yet on here??.....tried to add the Parental Control feature but i keep getting denied and i dont know why......can anyone help out here??....thanks!!

    The Link below will take you directly to the Block calls and messages page of you My Verizon account.  It will require you to sign in first.  
    https://nbillpay.verizonwireless.com/vzw/secure/messageIntercept/messageInterceptHome.action
    Thank You 

  • Change working mode on X-Fi Titanium Fatality cause system freeze

    Hi.
    Using X-Fi Titanium Fatality soundcard and latest beta driver. But then I need change working mode (from Game to Audio Creation or Audio Creation to Game) it's cause system freeze. And only hard reset helps. No errors message or error logs in system.
    This problem appear only if I played any games in Game mode and after want listen music in Audio mode. If don't play any games or listen music, you can change modes multiple times without problem.
    I try clean Windows 7 installation and problem is still here.
    Attached log information from Creative System Information.
    My computer configuration - http://systemprofile.net/p/1/Kuja
    Attached Files
    CTSi.zip
    (18.4 KB, 0 views)

    Sorry but support doesn't monitor these discussion boards. Please use this email form to contact them.

  • I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    PhotogYogi wrote:
    I Have the same issue on a brand new iPad mini 2. My battery is only lasting up to 5 hours. I went on chat with Apple last night and they said my battery is fine and its a Safari issue. I'm literally losing 1% every 3-4 minutes. I tried recalibrating my battery, signing out of iCloud, shutting off all locations, turning off background app refresh, restoring network settings, restoring all, and finally restoring from iTunes with no luck. This is just awful. I got this iPad so I could use it on my long flight for a trip I have coming up, and unfortunately, it's not going to last that long, plus I'm concerned about how many times i will be recharging my battery because of this since battery's do have a life cycle dependent on the number of charges. This is frustrating and needs to be fixed ASAP and addressed by Apple.
    By the way, Apple told me to bring my device to the Apple Store because it's still under warranty. That's great and all, but I'm going to waste my time if there is no fix for this issue.
    Ok so you want Apple to address the problem, but yet you don't want to take it to them just in case they can't fix it? What if they can fix it? Complaining here certainly won't fix it.

Maybe you are looking for

  • How to exclude one or more than one member on report?

    Post Author: izhar CA Forum: WebIntelligence Reporting Hi all group members, I am working on BOXI R2. I have to ask that, How to exclude one or more than one member from the report. I know there is function of filter, through which we can see our des

  • Compilation of C program in 64 bit mode using  gcc

    How do i compile a C program in 64 bit mode using gcc 2.95.2. I am using Sun Os 5.8. Pls give the command

  • CrossTab Questions

    I have a crosstab that looks something like this:      Jan-08     Feb-08     Mar-08     Apr-08     May-08     Jun-08 Jan-08     A     B     C     D     E     F Feb-08          G     H     I     J     K Mar-08               L     M     N     O Apr-08 

  • Distinct records

    hi all, i am calculating sum for one column but i want sum for the distinct records from the table SELECT D_NUMBER,D_TYPE,SUM(D_AMT) FROM D_TABLE WHERE D_CODE =:PARAMETER GROUP BY D_NUMBER,D_TYPEin the above case D_NUMBER,D_TYPE may repeat i want the

  • LR2 and PS Eelements8 show different RGB for the same color - Please, HELP

    LR2, Elements 8, Color Chart 24 (CC24), Please help. I may need to reset LR2 to factory default or to something else. For the following RAW adjustments the tone curve set to Linear, Contrast and Brightness to 0 I have photographed a CC24 in RAW. Open