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.

Similar Messages

  • 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?)

  • Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke

    ID-CS3
    Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke. Is there a way to fix and have the graphic resize using the fill size without redrawing the shape? Something like expand appearance?
    I'm not looking for a workaround or to redraw the shape. This problem description was used to present the simplest explanation to recreate the problem.

    I'm not sure I understand your question/problem, but if I make a box with an outside stroke and assign a stroke color, then... invert the stroke and fill, the stroke gets redrawn as a centered stroke --- it is no longer an outside stroke.
    This seems to me to be incorrect behavior, but it's more likely I just don't understand *why* this happens.
    Tad

  • 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

  • OracleDataAdapter.Fill() slow while running in development enviornment

    I have found a potential issue with the OracleDataAapter where it runs slow during a Fill() execution under the following scenario:
    1) ODP.NET Version 10.1.0.400
    2) Visual Studio Framework Version 1.1
    3) Select command is a simple "SELECT * FROM <TABLE>" where some of the columns returned contain null values
    Under this scenario, the fill operation is slow and my CPU is pegged at 100% when running inside of the Visual Studio development environment. If I run it outside the development environment (CTRL-F5) it is not slow and runs fine.
    What I have found it the Oracle.DataAccess component is throwing an internal exception whenever it encounters a null value. The error can be obtained by changing Visual Studio to break into the debugger for all CLR exceptions (Debug Menu --> Exceptions). Here is the error being thrown:
    A first change exception of type 'System.InvalidCastException' occurred in oracle.dataaccess.dll
    Additional information: Column contains NULL data
    I can reproduce this problem with three lines of code:
    1. DataSet dataSet = new DataSet("SAMPLE");
    2. OracleDataAdapter adapter = new OracleDataAdapter("SELECT * FROM MYTABLE", "Data Source=MYDB.WORLD;User Id=my_user;Password=my_pwd");
    3. adapter.Fill(dataSet);
    I have seen other posts from people experiencing a similar problem, but not a resolution. Does anyone know if there is a resolution to this issue or is this a bug in the ODP library? Any help would be greatly appreciated.
    Thanks!
    Ross

    Well, I tried to open a TAR but don't seem to have ODP.NET anywhere in the product list. Interesting (perhaps) is that my test case runs in about 8 secs using the MS provider and something like 176 seconds using ODP.NET 10.1.0.4.0 and Oracle Client 10.1.0.4.0 on my low-end test machine. Here's my simple test case using the SH demo schema:
    using System;
    using System.Data;
    // using System.Data.OracleClient;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace DataAdapterTest
      /// <summary>
      /// Summary description for Class1.
      /// </summary>
      class Class1
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
          int tickStart = 0;
          int tickEnd = 0;
          string constr = "User Id=sh; Password=sh; Pooling=false";
          OracleConnection con = new OracleConnection(constr);
          con.Open();
          DataSet ds = new DataSet();
          OracleDataAdapter da = new OracleDataAdapter("select * from customers", con);
          tickStart = Environment.TickCount;
          da.Fill(ds);
          tickEnd = Environment.TickCount;
          Console.WriteLine("Total Ticks: {0}", tickEnd - tickStart);
          da.Dispose();
          ds.Dispose();
          con.Dispose();
    }- Mark

  • OracleDataAdapter.Fill Is Slow

    All,
    Can anyone help me understand why the call to oda.Fill in this function is so slow, about 8 to 10 seconds? If I execute the same SQL in Toad, it executes reliably about 500 milliseconds. I'm using Oracle.DataAccess v4.
    Public Shared Function Get24() As Data.DataTable
    Dim EndDT As Date = Now
    Dim StartDT As Date = EndDT.AddHours(-24)
    Dim sb As New System.Text.StringBuilder
    sb.Append("SELECT TO_TIMESTAMP(TO_CHAR(completed_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM') || TO_TIMESTAMP(TO_CHAR(rejected_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM') As DTS," & Space)
    sb.Append("DECODE(mes_srno_status,'03',0,'04',1) AS VALS," & Space)
    sb.Append("MES_ASSY_JOB_INFO.*" & Space)
    sb.Append("FROM MES_ASSY_JOB_INFO" & Space)
    sb.Append("WHERE" & Space)
    sb.Append("mes_srno_status IN ('03','04')" & Space)
    sb.Append("AND TO_TIMESTAMP(TO_CHAR(completed_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM')" & Space)
    sb.Append("|| TO_TIMESTAMP(TO_CHAR(rejected_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM')" & Space)
    sb.Append("BETWEEN :StartDate AND :EndDate" & Space)
    Using oc As New OracleCommand(sb.ToString, DAL.ODP.GetConnectionPMESDB)
    Dim p1 As New OracleParameter("StartDate", OracleDbType.TimeStamp, StartDT, ParameterDirection.Input)
    Dim p2 As New OracleParameter("EndDate", OracleDbType.TimeStamp, EndDT, ParameterDirection.Input)
    oc.Parameters.Add(p1)
    oc.Parameters.Add(p2)
    Using oda As New Oracle.DataAccess.Client.OracleDataAdapter(oc)
    Dim tempDT As New Data.DataTable
    oda.Fill(tempDT)
    Dim dt As New Data.DataTable
    Dim dc As DataColumnCollection = tempDT.Columns
    For Each c As Data.DataColumn In dc
    dt.Columns.Add(c.ColumnName, c.DataType)
    Next
    dt.Columns(0).DataType = GetType(Date)
    For Each dr As Data.DataRow In tempDT.Rows
    Dim dr1 As Data.DataRow = dt.Rows.Add
    Dim d As Date = Oracle.DataAccess.Types.OracleTimeStamp.Parse(dr(0))
    dr1(0) = d
    For i As Integer = 1 To dr.Table.Columns.Count - 1
    dr1(i) = dr(i)
    Next
    Next
    Return dt
    End Using
    End Using
    End Function
    The string builder produces the following SQL:
    SELECT TO_TIMESTAMP(TO_CHAR(completed_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM')
    || TO_TIMESTAMP(TO_CHAR(rejected_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM') AS DTS,
    DECODE(mes_srno_status,'03',0,'04',1) AS VALS,
    MES_ASSY_JOB_INFO.*
    FROM MES_ASSY_JOB_INFO
    WHERE mes_srno_status IN ('03','04')
    AND TO_TIMESTAMP(TO_CHAR(completed_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM')
    || TO_TIMESTAMP(TO_CHAR(rejected_time,'DD/MM/YY HH:MI:SS PM'),'DD/MM/YY HH:MI:SS PM') BETWEEN :StartDate AND :EndDate

    Is it the Fill method that is slow or something else, such as creating the connection pool? It would be easier to diagnose what the potential problem could be if we know which API calls are operating inordinately slowly.

  • OracleDataAdapter.Fill and arithmetic overflow exception

    Hi to all!
    In my ASP.NET 2.0 web-application I use ODP.NET to working with Oracle DB. When I execute a pipelined stored procedure an "Arithmetic pverflow exception" occures. Here is exception stack trace:
    в Oracle.DataAccess.Types.DecimalConv.GetDecimal(IntPtr numCtx)
    в Oracle.DataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
    в Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
    в Oracle.DataAccess.Client.OracleDataReader.GetValues(Object[] values)
    в System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)
    в System.Data.ProviderBase.SchemaMapping.LoadDataRow()
    в System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
    в System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
    в System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
    в System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    в System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
    в System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
    If I call this stored procedure from SqlNavigator it works properly. Hovewer I see that the data of one column of result cursor looks like 55,58554033940333204184424641611784101. If I round data of this column, the Fill method of OracleDataAdapter works without any exceptions. How can i solve this problem?
    Edited by: yoyoseek on Sep 3, 2008 2:09 AM

    Hi
    The reason you are seeing this, is because Oracle Number has a greater precision than .NET Decimal.
    There are a couple of ways out:
    * Convert manually to_char instead of number out.
    * Using OracleDataAdapter.SafeMapping, described here http://stanford.edu/dept/itss/docs/oracle/10g/win.101/b10117/features009.htm
    * Round down to the precision of .NET decimal before returning.
    Morten
    Edited by: gulhaugen on Sep 3, 2008 1:43 PM

  • Data provider internal error(-3000)  during DataAdapter.Fill

    I get this error sporadically.
    From other messages on this forum, it seems others are having similar problems. It appears the Oracle staff
    is still struggling to identify and fix (or did I miss a post?)
    I hope the next release can include some more informative diagnostic error messages. (no judgment implied, just a suggestion).
    But I need this to work, so I'm posting my
    info as well in hopes it will help.
    Sorry for the length, but I think all the detail may be needed to diagnose.
    I have been using ODP.Net for weeks without trouble
    until recently. I just added a CLOB field to my table yesterday, and
    the problem started. I don't know whether that's cause or coincidence.
    Possible workarounds I will try:
    1) Explicit select of columns rather than select *
    2) Retry once on failure after short delay
    Below, I'm including the exception message from the ASP.Net page.
    It occurs at the same spot in my code, but often
    it works fine. Now, an hour later, I cannot repeat the problem.
    I've edited the "Source Error" section to
    provide more of the code, so you can see the full context.
    I've also pasted the stored procedure called so you can see what that is about.
    I need this to work, so feel free to contact me if you need further information
    to diagnose this in order to fix it.
    I go live on March 7, so if I don't get a fix soon and can't find
    a workaround, I'll just make a lame error message like "Site is very busy, please try again".
    Even though the site is NOT busy. But having them try again seems to work.
    And I don't want to tell them why I'm asking them to try again <grin>.
    I am thinking of putting a try/catch block and sleeping for a second and then trying one more
    time in my code. I'll let you know if that is an effective work-around.
    David Kreth Allen
    University of Minnesota
    Carlson School of Management
    [email protected] remove XYZ to send emails
    612-625-0386
    <WebPageError>
    Server Error in '/ScholarshipApplicationWeb' Application.
    Data provider internal error(-3000)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Oracle.DataAccess.Client.OracleException: Data provider internal error(-3000)
    Source Error:
         OracleCommand cmd = new OracleCommand();
         cmd.Connection = new OracleConnection(
              ApplicationEnvironment.current.database.OracleConnectionString);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "pkg_batch.get_details";
         cmd.Parameters.Add("batch_id",OracleDbType.Int32,
              batchId,ParameterDirection.Input);
         cmd.Parameters.Add("batchCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         cmd.Parameters.Add("majorsCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         cmd.Parameters.Add("detailCursor",OracleDbType.RefCursor,
              DBNull.Value,ParameterDirection.Output);
         OracleDataAdapter da = new OracleDataAdapter(cmd);
         DataSet ds = new DataSet("batches");
         da.Fill(ds);
         DataTable dt = ds.Tables[0];
         dt.TableName = "batch";
    Source File: C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs Line: 329
    Stack Trace:
    [OracleException: Data provider internal error(-3000)]
    Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, IntPtr opsSqlCtx, Object src, String procedure, String[] args)
    Oracle.DataAccess.Client.OracleDataReader.NextResult() +1259
    System.Data.Common.DbDataAdapter.FillNextResult(IDataReader dataReader) +98
    System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +261
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +129
    Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +516
    Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +290
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
    CSOM.ScholarshipLibrary.Data.ScholarshipApplicationBatch.getDataById(Int32 batchId) in C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs:329
    CSOM.ScholarshipLibrary.Data.ScholarshipApplicationBatch.GetById(Int32 batchId) in C:\Projects\ScholarshipSolution\ScholarshipLibrary\Data\ScholarshipApplicationBatch.cs:290
    CSOM.ScholarshipApplicationWeb.BatchSummaryControl.Edit_Click(Object sender, CommandEventArgs e) in c:\inetpub\wwwroot\ScholarshipApplicationWeb\BatchSummaryControl.cs:68
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +110
    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
    System.Web.UI.Page.ProcessRequestMain() +1244
    Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET Version:1.0.3705.288
    </WebPageError>
    <PackageBody>
    PROCEDURE GET_DETAILS(
    p_batch_id IN number,
    batchCursor OUT pkg_batch.refcur,
    majorsCursor OUT pkg_batch.refcur,
    applicationsCursor OUT pkg_batch.refcur
    IS
    BEGIN
    OPEN batchCursor FOR SELECT
    * FROM scholarshipApplicationBatch
    where scholarshipApplicationBatch_id = p_batch_id;
    OPEN majorsCursor FOR SELECT
    * FROM major_response
    where batch_id = p_batch_id;
    OPEN applicationsCursor FOR SELECT
    * FROM schol_detail
    where batch_id = p_batch_id;
    END GET_DETAILS;
    </PackageBody>

    One workaround that seems to work is to retry in a loop.
    Sample code is pasted below.
    Obviously it may still fail, but less often.
    I'll report any further changes that affect
    the behavior in hopes it will assist the Oracle staff in
    fixing it.
    <CODE>
    try
    da.Fill(ds);
    catch (OracleException excp)
         const int maxTrys = 5;
         int failureCount = 1;
         bool succeeded = false;
         for (int i = 0;i<maxTrys;i++)
              try
                   System.Threading.Thread.Sleep(
                        TimeSpan.FromSeconds(1));
                   ds.Clear();
                   da.Fill(ds);
                   i = maxTrys;
                   succeeded = true;
              }//try
              catch
                   failureCount ++;
         }//for
         errorHandler.Report(
              String.Format(
              "Failure in da.Fill in ScholAppBatch. " +
              " Failed {0} times. Finally Succeeded = {1}.",
                                            failureCount.ToString(),
         succeeded.ToString()),
              excp);
    }//catch
    </CODE>

  • OracleDataAdapter ORA-01722: Invalid Number

    I am Using .NET petshop Architecture and in this architecture oraHelper class have following code.
    public static DataTable ExecuteReader(string cmdText)
                   //Create the command and connection
                   OracleCommand cmd = new OracleCommand();
                   OracleConnection conn = new OracleConnection(CONN_STRING_NON_DTC);
                   try
                        PrepareCommand (cmd, conn, null, CommandType.Text ,cmdText ,null);
                   OracleDataAdapter sda = new OracleDataAdapter(cmd) ;
                        DataTable dt = new DataTable() ;
                        sda.Fill (dt);
                        conn.Close ();
                        return dt;
                   catch(Exception e )
                        conn.Close();
                        throw e ;
    I am getting error on FILL method as under
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Oracle.DataAccess.Client.OracleException: ORA-01722: invalid number.
    Could anyone tell me whats goign wrong.
    Regards
    Uzma

    Complete Exception trace is as under
    Oracle.DataAccess.Client.OracleException ORA-01722: invalid number at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleDataReader.Read() at System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping mapping) at System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDataReader dataReader) at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable dataTable, IDataReader dataReader) at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at odptest.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\odptest\webform1.aspx.cs:line 66

  • Table schema not being updated after a SQL 'alter'

    Hi all,
    I have a problem to do with altering table columns and queries relating to that table thereafter.
    I have a table which has been queried using an OracleDataAdapter.Fill(DataSet), if I add a column using say using an OracleCommand.ExecuteNonQuery() or sqlplus session (and doing a 'commit' after) the column does not show up on subsequant 'Fill' queries unless I reopen the DB connection.
    Just as an example, here is my test table which is defined as:
    create table steveTest
         id numeric,
         name varchar(15),
         address varchar(25)
    with a few rows of data in...
    If I query the table using ODP.NET (10 & 11)
    OracleDataAdapter oraDap = new OracleDataAdapter("select * from steveTest",oraCon);
    oraDap.Fill(ds);
    Everything is fine until I add/remove a column with say sqlplus or via an OracleCommand.ExecuteNonQuery()
    e.g     "alter table steveTest add address2 varchar2(30)"
    Subsequent Fill or data reader queries only show the unchanged table schema, without the newly added column. If I remove a column the symptoms are worse and I receive a "ORA-01007: variable not in select list"
    I can only think that ODP.NET is caching the schema for that table on that particular connection. Is there anyway to forcefully clear this out?
    I have tried OracleConnection.PurgeStatementCache(); but this doesn't seem to help me.
    My connection string is defined as:
    Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.0.27)(PORT=1521)))
    (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xe)));
    User Id=system;
    Password=mypass;
    HA Events=true;
    Validate Connection=true;
    Pooling=false;
    Enlist=false;
    Statement Cache Purge=true;
    Statement Cache Size=0;
    The application I am writing is a middle tier application which handles various DB drivers and maintains several 'connection queues' which multiple lightweight client applications can use concurrently. As you can imagine, a possible scenario may arise where a table is queried, altered and then queried again which causes the above issue. The only way I can stop this from happening is if I close/open the DB connection but I don't want to do this after every alter statement.
    I have tried this on Oracle Express 10g and Oracle 10g servers with ODP.NET clients (10.2.0.100/2.111.6.0). Just a point I thought worth mentioning, this does not happen in sqlplus.
    Any help would be much appreciated.
    Regards,
    Steve

    maybe u can check by debuggin the incoming idoc in we19.
    1. check the data u are sending from the source system
    2. check for the field before and ater change in the target system.
    maybe the field is update with the same content. also check the status record of the idoc
    Message was edited by:
            Prabhu  S

  • Numeric Precision Error

    Hi,
    I am using ODP 10.2.0.2.21 with c# and .Net 2.0 and Oracle 10g.
    Most of my stored procedures output the results back to the caller in the form of a generic REF CURSOR. When I call OracleDataAdapter.Fill to populate a data-set using a call to one of these stored procedures, it works fine as long as the stored procedure returns data. If no rows are returned, I get the following error:
    [Oracle.DataAccess.Types.OracleTypeException]: numeric precision specifier is out of range (1 to 38).
    Looking up this error, I've found that it normally occurs as a result of an attempt to run some DDL SQL that creates a table with a numeric column whose precision exceeds the maximum allowable e.g. numeric(39). This is not the case here, as the stored procedures that are failing are mostly pure select statements and do not even utilise temporary tables or bulk collection. It is almost as if the OracleDataAdapter is unable to get the schema representation of the column when there is not at least one row of data.
    I have pasted the full exception stack below:
    at Oracle.DataAccess.Types.OracleDecimal.ConvertToPrecScale(OracleDecimal value1, Int32 precision, Int32 scale)
    at Oracle.DataAccess.Client.OracleParameter.PreBind_Decimal()
    at Oracle.DataAccess.Client.OracleParameter.PreBind(OracleConnection conn, IntPtr errCtx, Int32 arraySize)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
    at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
    Any help on this would be appreciated.
    Regards
    Roy Griffiths.

    Hi Mark,
    It would be difficult to distill this down to a small enough example to post, but I could email you an example if you want.
    I have done a bit more investigation however, and believe that I have found the cause of the problem.
    My application obtains the parameters for any stored procedure that it calls using OracleCommandBuilder.DeriveParameters. As this is an expensive call (it requires a round trip to the database), I cache the output when a stored procedure is called for the first time. Specifically, I store a number of properties for each stored procedure parameter, including its precision and scale. I then use the cached properties to build the parameters collection on the command object when the stored procedure is called.
    I've noticed that the OracleParameter.Precision and OracleParameter.Scale properties always return zero, regardless of the definition of the parameter on the stored procedure. I've also noticed that there are 2 private member variables (m_precision and m_scale) that contain non-zero values. If I use reflection to obtain and cache these values and use them to set the scale and precision of Command.Parameters[n] then the problem goes away.
    I'm not particularly keen on this as a solution however, and would much rather use the public properties for precision and scale (OracleParameter.Precision and OracleParameter.Scale). Do you have any idea why they don't return values?
    Regards
    Roy.

  • Difference between 9.2.04 and 9.2.07

    I have an application (in vb.net) that uses ODP. I changed the ODP driver on my development machine to version 9.2.0.7 instead of 9.2.04. I then launched my site on to two different servers - one with 9.2.04 and one with 9.2 .07 driver. when i run the web application it runs fine on the server with 9.2.07 driver but on the other server I get the following message:
    "Exception: Connection must be open for this operation" - I know that it is not a programming error . because the exact same code works on all machines with 9.2.07 drivers. Is there anyway to make a solution to this problem without installing 9.2.07 drivers? If not - is there anywhere where I can get the 9.2.04 installer again?

    Following bugs of 9.2.04 had been fixed in 9.2.07.
    1. OracleDataAdapter().Fill leaks memory if table has more than 2 Lobs.
    [Bug #3185445]
    2. Access violation fetching XMLTYPE column from table with more than
    4K rows. [Bug #3184448]
    3. Anonymous PL/SQL with declare of REF OCURSOR populates dataset with
    data lost. [Bug #3146174]
    4. Connection is in closed state after ORA-28002 error (password will
    expire). [Bug #3121732]
    5. Connection.Close gives System.NullReferenceRxception. [Bug #3118886]
    6. ArgumentNullException in concurrent use of enlisted and non-enlisted
    pool. [Bug #3113518]
    7. Wrong behavior of OracleTimeStampTZ.
    [Bug #3100312]
    8. Internal error -3000 in ExecuteReader() with failover.
    [Bug #3076344]
    10. Transaction Option attribute is changed by execution sequence of COM
    component. [Bug #3071381]
    11. Intermittent hang in OracleXmlType.Extract() or dispose().
    [Bug #2954052]
    12. Case stmt caused internal error -3000. [Bug #2927159]
    13. Anonymous PL/SQL with DECLARE block retrieves only first REF Cursor.
    [Bug #2816634]
    14. ExecuteScalar on "Select sys_xmlgen(222).GetClobVal() from dual"
    fails. [Bug #2716184]
    Thnkx
    Adnan Memon

  • How do I limit the number of rows retrieved at a time using RefCursor?

    I have a PL/SQL package in use, that returns a REF CURSOR. This is currently being used in a Forms 6i application. Now I want to develop an ASP.NET web application that displays exactly the same information as my Forms 6i module. In fact those two applications will be used concurrently for a while.
    I looked at the sample code provided on otn.oracle.com and decided to use the OracleDataAdapter.Fill()-method to fill a dataset and bind that dataset to a pageable GridView. Now I wonder, whether this method retrieves ALL records of the query at once and how I can limit the number of rows fetched? The Select statement retrieves up to 10000 rows at a time. Most of the time, a user is only interested in the first 20-30 rows. Forms 6i fetches more rows as the user scrolls down, how can I implement the same behavior in ODP.NET?
    - Markus

    Excuse me, but the reply does not quite answer my question. Maybe I did not explain my concerns clear enough:
    I understand the use of the two properties (RowSize and FetchSize) to reduce the amount of round trips needed to transfer the data - not the number of rows fetched in total. This would still lead to a situation where all rows are transferred, when I am using the OracleDataAdapter.Fill()-Method. Is this correct or did I misunderstand the function of this method?
    I quote the otherwise really helpful article you send me:
    Of course, there is a cost if the fetch size is arbitrarily large. More client-side memory and processor cycles will be needed to store and manage a larger amount of data. The goal is to find a high-performing balance between the number of round trips and the amount of data retrieved per trip.
    My RowSize is for sure a bit larger than the one in the given example. The query will probably be used by up to 100 users at a time, so I would like to limit the resource-costs not only on the network by the number of round trips, but also on the web-server which is storing all these records in it's memory per user-request.

  • ABAP Objects, OLE & Cool:Gen

    Hello ABAP-ers,
    I have been messing around for a few hours now trying to get the right statements, but gettings desparate or better said angry, so Im posting this message in the hope to get some useful tips.
    For a customer I am developing an ABAP class which should make it possible to call a non SAP screen,  but a so-called Cool:Gen screen via OLE commands. In this screen some screenfields should be filled and a button should be pushed.
    The original coding from Cool:gen looks like this (which is programmed by a Cool:Gen programmer) :
    Create an instance of the application 'GINDA051'  and save a handle to the application in 'w_applicatie gui guiobject'
    SET w_applicatie gui guiobject TO CreateObject("GINDA051.Composer.Application")
    Determine the handle of the window in the application (there's only one) and save this in 'w_window gui guiobject'
    SET w_window gui guiobject TO w_applicatie gui guiobject.Windows().Item(1)
    Fill a number of fields with values
    w_window gui guiobject.Field("efiInterface").Value TO "Job1"
    w_window gui guiobject.Field("efiKey1").Value TO "PieceId"
    w_window gui guiobject.Field("efiValue1").Value TO "20070313000001"
    Trigger the Start button
    INVOKE w_window gui guiobject.Button("pbtStart").Click()
    My SAP coding so far looks like this:
    Including OLE types
      INCLUDE OLE2INCL.
    Tables and variables for later use
    DATA: APPLICATION TYPE OLE2_OBJECT.
    Create the object
    CREATE OBJECT APPLICATION 'GINDA051.Composer.application'.
    If I execute this code, the screen appears, but I cant get the screen fields filled, cause I dont know how to get a connection to the screen. I dont know how to translate the second statement to an ABAP statement and I dont know if I should a use the command to execute a method, of to fill a parameter.
    Filling one of the screen fields I guess would go via this statement, but it doesnt work.
    SET PROPERTY OF APPLICATION 'efiInterface' = 'taak1'.
    Well, I know that this is not an allday situation I am explaining and I can imagine that you thinks this is rather vague, but he Im trying anyway.
    Any tips would be greatly appreciated!
    Kind regards,
    Erik

    Hello,
    I found out which coding to use to get the functionality I needed, namely:
    - Calling a screen
    - Filling some fields in it
    - Executing a certain function (clicking a button)
    This is the code, maybe it will be of use for someone.
    Including OLE types
      INCLUDE OLE2INCL.
    Tables and variables for later use
      DATA: APPLICATION TYPE OLE2_OBJECT,
            WINDOW      TYPE OLE2_OBJECT,
            FIELD1      TYPE OLE2_OBJECT,
            FIELD2      TYPE OLE2_OBJECT,
            FIELD3      TYPE OLE2_OBJECT,
            BUTTON      TYPE OLE2_OBJECT.
    Stap 1
      CREATE OBJECT APPLICATION 'GINDA051.Composer.application'.
    Stap 2
    Handle naar scherm
      CALL METHOD OF APPLICATION 'CurrentWindow' = WINDOW.
    Veld 1
      CALL METHOD OF WINDOW 'Field' = FIELD1
        EXPORTING
        #1 = 'efiInterface'.
      SET PROPERTY OF FIELD1 'Value' = 'taak1'.
    Veld 2
      CALL METHOD OF WINDOW 'Field' = FIELD2
        EXPORTING
        #1 = 'efiKey1'.
      SET PROPERTY OF FIELD2 'Value' = 'depotstukId'.
    Veld 3
      CALL METHOD OF WINDOW 'Field' = FIELD3
        EXPORTING
        #1 = 'efiValue1'.
      SET PROPERTY OF FIELD3 'Value' = '20070313000001'.
    Handle naar button
      CALL METHOD OF WINDOW 'Button' = BUTTON
        EXPORTING
        #1 = 'pbtStart'.
      CALL METHOD OF BUTTON 'Click'.
      FREE OBJECT BUTTON.
      FREE OBJECT FIELD1.
      FREE OBJECT FIELD2.
      FREE OBJECT FIELD3.
      FREE OBJECT WINDOW.
      FREE OBJECT APPLICATION.

  • Ref cursor based on join or nested select is empty

    Hi ,
    We have a Stored procedure which returns 27 ref cursors.
    We are populating this data into a suitable data set using OracleDataAdapter (.fill).
    Refcursors that the data they hold is from a join or nested select are result empty.
    The other refcursors are fine.
    If running the stored procedure in the database (from another SP for instance) all refcursors are full of data.
    Can someone direct me for a solution or even working work around ?
    Thanks

    Hi Again ,
    No, The cursors are not any of group by with some aggregations of any sort. Just plain and simple joins or nested queries (Select... from ... where ... in (select ...). Some of the data is taken from temporary tables.
    For the last question i am using the production ODP with the last oraMTS.
    This problem is really stopping us from going to production in early march ....
    A possible work around we thought about (but cost dearly ...) is to fill the data from the tables into a temporary one and then base the cursor on a query on this table. This workaround can last only a few weeks at the customer.
    Regards

Maybe you are looking for