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

Similar Messages

  • 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

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

  • OracleConnection.Open() OverflowException

    hi, getting following exceptions in connection object on production environment :
    System.OverflowException: Arithmetic operation resulted in an overflow.
    at Oracle.DataAccess.Client.OracleConnection.Open()
    the problem occures after system is running about a day without any issues, once exeption occured, each attempt to open connection fails till hosting process is restarted
    we are using Oracle.DataAccess, Version 2.102.2.21 on windows server 2003 64 bit, Oracle 10g enterprise edition.
    connection configured by pool usage : 'Min Pool Size=10;Connection Lifetime=80;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2;Min Pool Size=10;Connection Lifetime=80;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2'
    any help appreciated.
    Thanks,
    EV

    Hi Folks -
    Kind of related to the problem above ... we had the following error
    System.OverflowException: Arithmetic operation resulted in an overflow.
    using W2K3 R2 64 bit with IIS 6.0 and the .Net 2.0 framework with an Oracle 10.2.0.4 client connecting to an 11g database (bug in the 11g client forced us to fall back to using 10 client for now).
    Anyways we had installed the 10.2.0.2x64(beta) version of the ODAC components and almost immediately afterwards started getting the System.OverflowException: Arithmetic operation resulted in an overflow error.
    For us, the solution was to download the ODAC 10.2.0.3 and install it. No more System.OverflowException: Arithmetic operation resulted in an overflow errors after this.
    Hope this will help someone.
    LJ
    Message was edited by:
    4n6

  • Issue with Generate Create Script in new ODT 11.1.0.6.10 beta

    I've tried this on several tables in my database. I choose Generate Script to ... a file, for a given table it gives me the error message "An error occurred while writing to fil: \nValue was either too large or too smal for an Int32."
    (It doesn't matter if I'm in a Oracle database project or some other project.)
    Trying to Generate Script To Project... when I'm in a Oracle Database Project, Visual Studio (2005) crashes. It appears to be some overflow exception according to crashinfo:
    EventType : clr20r3 P1 : devenv.exe P2 : 8.0.50727.762 P3 : 45716759
    P4 : mscorlib P5 : 2.0.0.0 P6 : 461eee3d P7 : 407b P8 : a3
    P9 : system.overflowexception
    (With ODT 11.1.0.5.10 beta it worked fine dispite the issue discussed in thread: Re: Issue with Generate Create Script in new ODT 11.1.0.5.10 beta
    /Tomas

    Tried to debug this error and got these exception details. Hope it helps!
    /Tomas
    System.OverflowException was unhandled
    Message="Value was either too large or too small for an Int32."
    Source="mscorlib"
    StackTrace:
    Server stack trace:
    at System.Decimal.ToInt32(Decimal d)
    at System.Decimal.op_Explicit(Decimal value)
    at Oracle.Management.Omo.TableSpaceQuotaDetails.FillTableSpaceQuota(OracleDataReader reader)
    at Oracle.Management.Omo.User.FillTableSpaceQuotas(OracleDataReader reader)
    at Oracle.Management.Omo.Connection.GetUserCollection(Boolean refresh)
    at Oracle.Management.Omo.Connection.GetUsers(Boolean refresh)
    at Oracle.Management.Omo.TableSQLGenerator.GetCreateSQLs(OmoObject obj, ArrayList& typeAndNames, Boolean checkRequired, Boolean appendSchemaName)
    at Oracle.Management.Omo.TableViewBase.GetCreateSQLs(Boolean appendSchemaName)
    at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateCreateScript(OracleUILConnCtx connCtx, String[] objectNames, String objectOwner, OracleUILObjectType objectType)
    at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateCreateScriptAsyncMethod(IntPtr ppvObj, OracleUILConnCtx connCtx, String[] objectNames, String objectOwner, OracleUILObjectType objectType, ICollection& scriptText)
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
    at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
    at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateScriptAsyncMethodDelegate.EndInvoke(ICollection& scriptText, IAsyncResult result)
    at Oracle.VsDevTools.OracleUILDBProjectServices.OnGenerateScriptAsyncCompletion(IAsyncResult ar)
    at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage msg)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
    at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Object o)
    at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

  • Managed ODP: InvalidCastException when returning large number

    I get an InvalidCastException "Specified cast is not valid" when trying to get a value bigger than Decimal.MaxValue as a scalar result from a select.
    From the stack trace and inspection of the Oracle.ManagedDataAccess.dll code I would expect OracleDataReader to cast to OracleDecimal (or System.Numerics.BigInteger) instead of System.Decimal for large numbers.
    Is this a bug?
    Stack trace:
       at Oracle.ManagedDataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
       at Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)
       at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteScalar()
       at Cora.Data.DBProvider.Tests.CoraParameterTest.BigIntegerOracleTest() in D:\svnroot\tech\lib\Cora.Data.DBProvider\Cora.Data.DBProvider.Tests\CoraParameterTest.cs:line 98
    How to reproduce:
    - create a table NUNITTEST_PARAM_SIMPLE with a column BIG of type NUMBER(38)
    - run sample code
                using ( OracleConnection conn = new OracleConnection(ORACONN) )
                    conn.Open();
                    using ( OracleCommand cmd = conn.CreateCommand() )
                        cmd.CommandText = "insert into NUNITTEST_PARAM_SIMPLE (BIG) values (1234567890123456789012345678901234567)";
                        cmd.ExecuteNonQuery();
                    using ( OracleCommand cmd = conn.CreateCommand() )
                        cmd.CommandText = "select BIG from NUNITTEST_PARAM_SIMPLE";
                        object result = cmd.ExecuteScalar();          // Exception
                    conn.Close();

    There is no safe type mapping for ExecuteScalar. It's an uncommon use case.
    Even if there was, making the correct conversion implicitly would lead to more work for the application developer. Let's assume ODP.NET performs the "right" conversion. Now, the app needs to manipulate the data. What data type does it treat the returned value as: string or decimal? It could be either. That means twice as much code. One set deals with the data if a decimal was returned. The second deals with the data if a string is returned.
    It would be much easier to write code for one scenario, rather than two. That is why ODP.NET safe type mapping is an explicit conversion the developer makes.

  • OVERFLOW

    Hi,
    we try to get Data from a Table.
    When we use
    'select fielda,fieldb,....fieldx from thetable'
    all is fine
    but when we do a
    'select * from thetable'
    this error occures:
    System.ApplicationException: System.Exception: System.Exception: System.OverflowException: ORA-22053: Überlauffehler
    at Oracle.DataAccess.Client.OracleDataReader.GetInt32(Int32 i)
    at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
    at Oracle.DataAccess.Client.OracleDataReader.GetValues(Object[] values)
    at System.Data.Common.SchemaMapping.LoadDataRow(Boolean clearDataValues, Boolean acceptChanges)
    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(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
    at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
    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)

    Hi David,
    Thx for this answer, but i think it is not the problem.
    I see it in a way like this:
    We fill a Database table(Oracle 10g) with values
    and the Database accepts the values.
    Then we use features from the Database Provider to get the data back . (ODP.Net from Oracle )
    The result is an error in the ODP.net method . This is simply a bug.
    If i have standard methods like xxxDataAdapter.Fill and simple sql statements then I dont expect a technical problem, where i have to find a way to make it run.
    This is not the first problem that we came to, so I think the ODP.Net (and also the new OracleOleDb driver) has some problems with the result of a simple query.
    What shall we expect from more complicated functions?
    The 9i version didnt have this kind of problem.

  • 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

  • Exchange 2010 SP3 UR2 and Event 4999 = AirSync, M.E.Data.Storage, M.E.D.S.AppointmentTombstone

    Hello together,
    i'm having the following event on my cas servers every about 30 minutes:
    Event 4999 MSExchange Common
    Watson report about to be sent for process id: 5780, with parameters: E12, c-RTL-AMD64, 14.03.0151.000, AirSync, M.E.Data.Storage, M.E.D.S.AppointmentTombstone..ctor, System.OverflowException, 7f09, 14.03.0158.001.
    ErrorReportingEnabled: False
    it looks like it is a known bug fixed in SP3 UR3 (http://support.microsoft.com/kb/2891587/de) ?
    http://support.microsoft.com/kb/2888911/de
    they are talking there about a workarround to delete the problematic "thumbstone data". but how to find and identiy them before deletion ?
    "To work around this issue, use the MFCMAPI tool to remove the corrupted tombstone data."
    thanks for feedback,
    best,
    martin

    Hello Martin,
    I have a user who is having this exact same issue. I know this thread is a few months old, did you ever find an answer to where the corrupted tombstone data was located at?
    thanks,
    Emmanuel Fumero Exchange Administrator

  • Calling ALL Experts...SSIS Package keep failing in Debug Mode..SQL 2005

    Hello everyone,
    I just want to thank you in advance for all the help that you can give today. 
    I just started at a new Company, as a junior DBA, the previous person left. Before that person left he created a lot of SSIS packages and
    turn them into jobs basically to refresh many different tables on the SQL server. The datas are being import from another datasource, which is why the SSIS packages was created so we can bring the datas over to SQL side.  Whenever I want to create a new
    SSIS Package for a new job, I always get the same failure as below...
    "Error: 0xC0047062 at Data Flow Task, Source - Query [1]: System.OverflowException: Arithmetic operation resulted in an overflow.
    at System.Data.Odbc.OdbcStatementHandle.RowCount(SQLLEN& rowCount)
    at System.Data.Odbc.OdbcDataReader.GetRowCount()
    at System.Data.Odbc.OdbcDataReader.FirstResult()
    at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments,
    SQL_API odbcApiMethod)
    at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
    at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
    at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader(CommandBehavior behavior)
    at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
    at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.PreExecute()
    at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper90 wrapper)
    Error: 0xC004701A at Data Flow Task, DTS.Pipeline: component "Source - Query" (1) failed the pre-execute phase and returned error
    code 0x80131516.
    Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
    Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination - GLCGLDS" (103)" wrote 0 rows.
    Task failed: Data Flow Task
    SSIS package "SSIS_GLCGLDS_GL.dtsx" finished: Failure.
    The program '[16836] SSIS_GLCGLDS_GL.dtsx: DTS' has exited with code 0 (0x0)."
    All the SSIS packages are failing for me, not just the one I created, even the ones that were working
    before, the ones that were created by the previous person, I just went to Start Debugging and it would failed at the same exact stage
    Below are the exact steps that I do to create the SSIS Package (based on the notes from previous person)
    1. right click on SSIS Package and select sql server import and export wizard and click next
    2. Select data source as .Net framework Data Provide for ODBC
    3. Input Datasource, and driver as: TS ODBC Multi – Tier Driver
    4. Choose destination as Microsoft OlE DB Provide for SQL Server
    5. Write a basic select statement.
    6. Click edit Mappings
    7. Here's the important part... I am ABLE to preview the DATA.
    8. Click ok  next  finished
    9. Click debug start debugging
    10. The preparation SQL task will be green, but the Data Flow Task will failed everytime for me.
    If anyone has any suggestion please let me know, b/c I have try every possible ways and out of luck, and I don't want to explain to my boss
    I don't know how to do it or how the previous person does it without any failures.
    TL

    Below are the exact steps that I do to create the SSIS
    Package (based on the notes from previous person)
    1. right click on SSIS Package and select sql server import and export wizard and click
    next
    2. Select data source as .Net framework Data Provide for ODBC
    3. Input Datasource, and driver as: TS ODBC Multi – Tier Driver
    4. Choose destination as Microsoft OlE DB Provide for SQL Server
    5. Write a basic select statement. (select * from tableA)
    6. Click edit Mappings to modify few column with their data type
    7. Next -> Here's the important part... when I clicked on Preview Data, I am ABLE to
    preview the DATA.
    Finished.

  • Execute store procedure( in Id, in out RefCursor), and data fetched in ref cursor should be sent out as excel sheet.

    I am trying to make a ssis package that get the data calling the store proc with two param one is ID and other is Sys_refcursor. Say Store Proc as ListName(Id int, myCur sys_refcursor), which gets the datas with the conditions inside it.
    REATE OR REPLACE PROCEDURE schemaName.LISTNAME (P_ID  IN INT, LST_NAME_REFCUR   IN OUT SYS_REFCURSOR)
    IS
    P_NAMESOURCE_ID INT;
    BEGIN
        SELECT SOURCE_ID INTO P_NAMESOURCE_ID FROM SEARCHING_TABLE ST WHERE ST.ID = P_ID;           
                   IF (P_NAMESOURCE_ID=1)
                   THEN
                      OPEN LST_SOURCE_REFCUR FOR 
                            SELECT ST.ID,
                                   ST.TRANSACTION_DATE AS TRAN_DATE,
              IF (P_NAMESOURCE_ID=1)
                   THEN 
                      OPEN LST_SOURCE_REFCUR FOR             ....     
    then i need to get the data from that refcursor and fetch those data to excel sheet to a virtual directory.
    Any help would be appreciated. I am new to SSIS. and i need to do this assignment this friday. 

    Hi 11srk,
    To fetch data from Oracle store procedure, you can use a Script Component as source to call the Oracle stored procedure by using System.Data.OracleClient OracleDataReader, and get the rows and add them to the pipeline buffer. For more information, please
    see:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d0b3a1b-8792-469c-b0d1-f2fbb9e9ff20/dump-oracle-ref-cursor-into-ms-sql-staging-table-using-ssis
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fcdaa97e-8415-4c3e-8ffd-1ad45b590d57/executing-an-oracle-stored-procedure-from-ssis?forum=sqlintegrationservices
    http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader(VS.90).aspx  
    Regards,
    Mike Yin
    TechNet Community Support

  • Getting data stored in ref cursor ( got from store proc in oracle) to excel sheet)

    Hey, I am trying to Get data stored in ref cursor ( got from store proc in oracle) to excel sheet in a virtual folder using ssis. 
    I am getting errors and cant do it. If anyone can help me

    Hi Nabin000,
    The Oracle stored procedure doesn't work with SSIS source adapters such as OLE DB Source because the data provider doesn't provide metadata for the source adapter. To achieve your goal, you can use a Script Component as source to call
    the Oracle stored procedure by using System.Data.OracleClient OracleDataReader, and get the rows and add them to the pipeline buffer. For more information, please see:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d0b3a1b-8792-469c-b0d1-f2fbb9e9ff20/dump-oracle-ref-cursor-into-ms-sql-staging-table-using-ssis
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fcdaa97e-8415-4c3e-8ffd-1ad45b590d57/executing-an-oracle-stored-procedure-from-ssis?forum=sqlintegrationservices 
    http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader(VS.90).aspx 
    Regards,
    Mike Yin
    TechNet Community Support

  • How to add inline TVF with dynamic columns from CRL Dynamic Pivot

    Hi I am trying to implement the code in the following article.
    SQLServerCentral Aricle
    Now, I've pushed the assembly to my DB and can see it there. 
    So far I have tried building an Inline TVF, as I assume this is how it would be used on the DB; however, I am receiving the following error on my code, I must
    be missing a step somewhere, as I've never done this before. I'm lost on how to implement this clr function on my db?
    Create Function script:
    CREATE FUNCTION clrDynamicPivot
    @query nvarchar(4000),
    @pivotColumn nvarchar(4000),
    @selectCols nvarchar(4000),
    @aggCols nvarchar(4000),
    @orderBy nvarchar(4000)
    RETURNS TABLE
    AS
    return
    (external NAME CLRfunctions.RIFunctions.clrDynamicPivot)
    GO
    Error:
    Msg 156, Level 15, State 1, Procedure clrDynamicPivot, Line 18
    Incorrect syntax near the keyword 'external'.
    public static void CreateTempTable(SqlString query)
                using (SqlConnection sqlconn = new SqlConnection("Context Connection=True"))
                    SqlCommand sqlCmd = sqlconn.CreateCommand();
                    sqlCmd.CommandText = query.ToString();
                    sqlconn.Open();
                    sqlCmd.ExecuteNonQuery();
     public static string GetPivotData(string pivotColumn)
                string stmt = string.Format("select distinct {0} from #temp", pivotColumn);
                string pivotCols = string.Empty;
                using (SqlConnection cn = new SqlConnection("Context Connection=True"))
                    SqlCommand cmd = cn.CreateCommand();
                    cmd.CommandText = stmt;
                    cn.Open();
                    using (SqlDataReader dr = cmd.ExecuteReader())
                        while (dr.Read())
                            if (dr.GetFieldType(0) == typeof(System.Int32))
                                pivotCols += "[" + dr.GetInt32(0) + "],";
                            if (dr.GetFieldType(0) == typeof(System.Decimal))
                                pivotCols += "[" + dr.GetDecimal(0) + "],";
                            if (dr.GetFieldType(0) == typeof(System.String))
                                pivotCols += "[" + dr.GetString(0) + "],";
                return pivotCols.Remove(pivotCols.Length - 1);
    [Microsoft.SqlServer.Server.SqlProcedure(Name="clrDynamicPivot")]
    public static void clrDynamicPivot(SqlString query, SqlString pivotColumn, SqlString selectCols, SqlString aggCols, SqlString orderBy)
        string stmt = string.Empty;
        try
           CreateTempTable(query);
           string pivot = GetPivotData(pivotColumn.ToString());
           stmt = string.Format("select * from ( select {0} from #temp ) as t pivot ( {1} for {2} in ( {3} )) as p {4}",
           selectCols.ToString(),
           aggCols.ToString(),
           pivotColumn.ToString(),
           pivot,
           orderBy.ToString());
           using (SqlConnection cn = new SqlConnection("Context Connection=True"))
              SqlCommand cmd = cn.CreateCommand();
              cmd.CommandText = stmt;
              cn.Open();
              SqlDataReader reader = cmd.ExecuteReader();
              SqlContext.Pipe.Send(reader);
         catch (Exception ex)
           throw new Exception(string.Format("clrDynamicPivot Error stmt:{0}", stmt), ex);
    DECLARE @query nvarchar(4000)
    DECLARE @pivotColumn nvarchar(4000)
    DECLARE @selectCols nvarchar(4000)
    DECLARE @aggCols nvarchar(4000)
    DECLARE @orderBy nvarchar(4000)
    set @query = 'select PayMethod, datepart(hh, OrderDate) as OrderHour, ProductTotal into #temp from dbo.Orders (nolock) where OrderDate between getdate()-1 and getdate() and division = ''15'''
    set @pivotColumn = 'PayMethod'
    set @selectCols = 'PayMethod, OrderHour, ProductTotal'
    set @aggCols = 'sum(ProductTotal)'
    set @orderBy = ''
    EXECUTE dbo.clrDynamicPivot
    @query
    ,@pivotColumn
    ,@selectCols
    ,@aggCols
    ,@orderBy
    GO

    You can't build an inline TVF in SQLCLR, only (the equivalent of) multi-statement TVFs and scalar functions. And the SQLCLR code for multi-statement TVFs must be coded with a specific pattern, see
    https://msdn.microsoft.com/en-us/library/ms131103.aspx.
    Looking at the example you reference, it was implemented as a SQLCLR stored procedure.
    Cheers, Bob
      

  • Azure + Sync Framework + Error: Value was either too large or too small for a UInt64

    Hi,
    We have an in-house developed syncronisation service built on the Sync Framework v2.1 which has been running well for over 2 years. It pushes data from a local SQLServer 2005 database to one hosted on Azure with some added encryption.
    The service was stopped recently and when we try to re-start it, it fails with the error:
    System.OverflowException: Value was either too large or too small for a UInt64.
    at System.Convert.ToUInt64(Int64 value)
    at System.Int64.System.IConvertible.ToUInt64(IFormatProvider provider)
    at System.Convert.ToUInt64(Object value, IFormatProvider provider)
    at Microsoft.Synchronization.Data.SyncUtil.ParseTimestamp(Object obj, UInt64& timestamp)
    at Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeHandler.GetLocalTimestamp(IDbConnection connection, IDbTransaction transaction)
    I have found the Hotfix 2703853, and we are proposing to apply this to our local server, but we have found that running SELECT CONVERT(INT, @@dbts) on the local database returns 1545488692 but running the same query on the Cloud database returns -2098169504.
    which indicates the issue is on the Azure side. Would applying the hotfix to our local server resolve the issue or would it need to be somehow applied to the Azure server?
    Thanks in advance for any assistance!
    Chris

    Hi,
    We have now applied the Sync Framework hotfixes to our server and re-provisioned the sync service. No errors were reported and the timestamp values were all within the required range. On re-starting the service the system worked as anticipated. It has now
    been running for a week and appears to be stable. No further changes were required other than installing the hotfixes and re-provisioning the scope.
    Chris

  • EPMA process manager service is not starting

    Hi gurus,
    I'm working on Hyperion v-11.1.1.3 and in that i'm not able to start the EPMA process manager.It is throwing an error message as
    The Hyperion EPM Architect - ProcessManager service on local Computer started and then stopped
    Some services stop automatically if they have no work to do, for example, the performance Logs and Alerts Service.
    When checking in the dimension server logs/eventvwr it is showing the following error message. But some times it is showing 1053 error message that-the process manager is not starting in a timely etc..
    *[Engine Startup] Hyperion.DimensionServer.Program.LogMessage(:0) - An error occurred during initialization of engine ID 1: ORA-01115: IO error reading block from file 4 (block # 782666)*
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-01115: IO error reading block from file 4 (block # 782666)
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-15081: failed to submit an I/O operation to a disk
    System.Data.OracleClient.OracleException: ORA-01115: IO error reading block from file 4 (block # 782666)
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-01115: IO error reading block from file 4 (block # 782666)
    ORA-15081: failed to submit an I/O operation to a disk
    ORA-15081: failed to submit an I/O operation to a disk
    at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
    at System.Data.OracleClient.OracleLob.Read(Byte[] buffer, Int32 offset, Int32 count)
    at System.IO.StreamReader.ReadBuffer()
    at System.IO.StreamReader.ReadToEnd()
    at System.Data.OracleClient.OracleLob.get_Value()
    at System.Data.OracleClient.OracleColumn.GetValue(NativeBuffer_RowBuffer buffer)
    at System.Data.OracleClient.OracleDataReader.GetValue(Int32 i)
    at Hyperion.DataAccessLayerCore.DALDatasetCommand.ColumnValue(Int32 index)
    at Hyperion.DataAccessLayerCore.DALRowset`1.Read()
    at Hyperion.DataAccessLayerCore.DALRowset`1.Execute()
    at Hyperion.DataAccessLayerCore.SelectCommand`1.Execute(Action`1 callback)
    *at Hyperion.DataAccessLayerCore.GenericDAO.Select[T](Action`1 callback, SetParamsEvent`1 onSetParams)*
    at Hyperion.DimensionServer.DAO.DimensionPropertyManagerDAO.LoadDimensionMemberMemoProperties(Int32 libraryID, Int32 dimensionID, Action`1 action)
    at Hyperion.DimensionServer.PropertyManager.LoadDimension(Dimension dimension)
    at Hyperion.DimensionServer.PropertyManager.LoadProperties()
    at Hyperion.DimensionServer.Library.Load()
    at Hyperion.DimensionServer.Global.Initialize(String jobManagerConnectString)
    at Hyperion.DimensionServer.Program.Main(String[] args)
    What could be the reason for the issue and the possible resolution.I have checked in other posts in the forum but unable figure out resolution.
    If it is related to Oracle client issue then where can we find out the installed oracle client in the server?
    Thanks in advance

    Hi John,
    Thanks for the information..i have checked and came to know that the db server is down.
    It is working fine now.
    Could you please let me know..what all the services will not be available if Process manager service is not started?
    Thanks in advance

Maybe you are looking for

  • Error in starting weblogic 10

    hey, I'm new to weblogic10, I got following error when tried to start up the server after configuring a domain: <Aug 6, 2007 12:40:56 PM PDT> <Error> <Security> <BEA-090870> <The realm "myrealm" failed to be loaded: weblogic.security.service.Security

  • Doubt in using alv's in FM

    Hi Folks, I am trying to use alv grid list display in function module with at user-command event to call specific transaction in my report. But its not working,its going to short dump. when i am doing this fucntionality in report its working fine but

  • What is the grey triangle and exclamation point when trying to view pics in iPhoto?

    having troubles with photoes that appear in iphoto as a thumnail but when selected a screen appears with a grey triangle and exclamation point ! what is this about?other photoes in the same album appear as they are selected!

  • Weblogic Transaction Rollback Illegal State

    Hi, We have 2 different components using EJBs talking to each. We have 1 session bean from 1 component calling another session bean from the 2nd component. The 2nd component uses transactional datasources while the 1st doesnt. We are starting to see

  • Will my mac pro support 10 Optical drives?

    I have a mid 2010 Mac Pro that currently has two Optical drives installed. I believe its the Two 2.4GHz Quad-Core Intel Xeon E5620 "Westmere" processors. I installed a Samaung 840 Evo for the operating system and I have a 6 TB raid installed with 16g