Bug: in ManagedDataAccess while fetch from "Select .., NULL, ... From dual"

Hi,
I have the problem with the new managed ODP.Net driver.
If I fetch data from a select which has column with a fixed value "NULL" the driver decides after a certain amount of data that the value is not null any more. Which causes a lot of problems especially if you try to hide not needed blob data.
The Problem somehow depends on the FetchSize of the command. It seems like the error occurs if more than one db round trip to fetch the result is necessary.
System: Windows 7 64 Bit
Platform: .net 4.0 x86
database: 11g Release 11.2.0.3.0 - 64bit Production
Oracle.ManagedDataAccess Version: 4.112.350
I created a small example to reproduce the problem.
Thanks for your help
Dominik
Stored Proc:
create or replace PROCEDURE TestNullField
  v_IntPara IN NUMBER DEFAULT NULL ,
  v_StrPara IN VARCHAR2 DEFAULT NULL,
  cv_1 OUT SYS_REFCURSOR
AS
BEGIN
      OPEN cv_1 FOR
        select rownum, v_StrPara, NULL from dual connect by level <= v_IntPara;
        --select IDX, NULL, DESCRIPTION FROM TEST_BLOBTABLE;
END;C# Code:
using System;
using System.Text;
using Oracle.ManagedDataAccess.Client;
using System.Data;
namespace OracleBlobTest
    class Program
        private static string _connectionString = @"User ID=YourUser;Password=YourPwd;Data Source=YourServer:YourPort/YourSchema;";
        private static string _spName = @"TestNullField";
        private static string _strPara = @" Long test string";
        private static int _intPara = 200;
        static void Main(string[] args)
            using (OracleConnection connection = new OracleConnection(_connectionString))
                using (OracleCommand cmd = connection.CreateCommand())
                    cmd.CommandText = _spName;
                    cmd.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    string alongString = _strPara;
                    while (alongString.Length < 2000)
                        alongString += alongString;
                    alongString = alongString.Substring(0, 2000);
                    OracleCommandBuilder.DeriveParameters(cmd);
                    if (cmd.Parameters.Count > 0 && (cmd.Parameters[0]).Direction != ParameterDirection.ReturnValue)
                        cmd.Parameters[0].Value = _intPara;
                        cmd.Parameters[1].Value = alongString;
                    // change this to change the moment when it starts to go wrong
                    ///cmd.FetchSize = 5000;
                    using (OracleDataReader reader = cmd.ExecuteReader())
                        int count = 0;
                        while (reader.Read())
                            count++;
                            for (int idx = 0; idx < reader.FieldCount; idx++)
                                if (reader.GetName(idx) == "NULL")
                                    if (!reader.IsDBNull(idx))
                                        //something is very wrong here - why is not not null any more???
                                        Console.WriteLine("Fix NULL Field[{0}] {1} is not null >{2}< in row {3} ", idx, reader.GetName(idx), reader[idx], count);
                        Console.WriteLine("Rows found: " + count);
                connection.Close();
            Console.WriteLine("done press enter");
            Console.ReadLine();
}Edited by: user540519 on 10.12.2012 15:11
Edited by: user540519 on 19.12.2012 13:50

Hello
I ran the testcase here and reproduced the issue on 32 bit unmanaged beta v4.0.30319
note: same testcase works with Oracle.DataAccess (but not with managed).
This appears to match unpublished defect Bug 14666093 and is meant to be fixed in a later beta release.
Some things I noticed when testing
with the default fetchsize the breaking point is 67 iterations.
e.g.
private static int _intPara = 66;    // Works
private static int _intPara = 67;  // Fails
If I increase the fetchsize then it breaks at different values as you noticed..
Hope this helps.
Kind Regards
John

Similar Messages

  • How to stop Mail from selecting addresses from the list of Previous Recipients?

    How to stop Mail from selecting addresses from the list of Previous Recipients?

    This is a related question.
    I deleted ALL my previous recipients and when I create a new e-mail it STILL is getting addresses that I don't want - they pop up and I don't know how to stop this!
    I switched from one ISP to another - I deleted the old e-mail account in MAIL - I DID use the same name on the account - is that why it keeps bringing up the old address? 
    ARGH!

  • Wrong results from "Select count(*) from tbl"

    I am the user of an Oracle DB and I am getting what
    look like wrong counts using "Select count(*)" statments.
    It first occurred when I tried to get monthly record counts with
    Select count(*), month
    from tbl
    group by month
    (Note this is the query I used with the exception
    of a change in the table name. The month field is numeric)
    All the monthly counts but one looked like it was 2x what it should be.
    Oddly enough if I tried
    Select count(*), month
    from tbl
    where month = 200302
    group by month
    OR
    Select count(*), month
    from tbl
    where month in (200301 200302)
    group by month
    I got what looked correct.
    I even got the 2X problem when I asked for a count on
    the entire table using
    Select count(*)
    from tbl
    One of our DBAs suggested the problem has somehting to do with
    the indexes and not running analyze on the table recently.
    I'll note also that the table is partitioned.
    I think it's Oracle version 8.1.7.4.0 running on a Sun box.
    Has anyone seen this before or does anyone have any
    suggestions on the cause of the problem?
    I have been told it has to do with indexes
    and I know there are many indexes on this table.
    The table is also partitioned.
    Thanks,
    - john

    plz copy and paste here your tests
    i am running 8.1.7.4.0 too and all is fine here...
    (i heard about a count(*) problem but on a lite version of an old 8.0.x...)
    Fred

  • Populate a table field from selection made from drop down menu

    Hello all,
    I'm having a bit of head scratching problem that i just can't get my head around. I'm using Dreamweaver CS4
    and phpmyadmin for my site.
    I have a form that inputs a record into a table in my database.
    The form is a user picking a fantasy sports team. A user selects a player from a drop down menu.
    The players name is got from a recordset that accesses the player database, with the values coming
    from the id field and the values from the name, so a user selects a player by there name and not
    there unique id value. The code for this is as follows:
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">GoalKeeper:</td>
    <td><select name="gkid_team">
    <?php
    do {
    ?>
    <option value="<?php echo $row_rs_pt_gk['gkid_gk']?>" ><?php echo $row_rs_pt_gk['gkname_gk']?></option>
    <?php
    } while ($row_rs_pt_gk = mysql_fetch_assoc($rs_pt_gk));
    ?>
    </select></td>
    What i'm trying to achieve is that when a user selects a player from the drop down menu, their price is displayed in the table cell next to the menu. The value is held in the same table of database as the names and id values. I need to do it so the page doesn't need to be refreshed so i assume i need to use some sort of javascript, php and/or maybe ajax. However with java and ajax i have very little or no experience so i'm not really sure what i'm doing. I've been on numerous forums, looked in text books and have been searching the net for hours but i can't seem to solve this problem.
    Any help or advice would really be appreciated as i just can't seem to get my head around it,
    Thanks,
    pb1uk

    can this be done??? thanks in advance annieYes.
    One way of doing it is submitting the form on change of the selected value and fetch back the query results. Have a servlet invoke the method and set the results in the request.
    Another way (not recommended) is to fetch the results corresponding to all the values in the dropdown and have it in the session. The latter solution would obviously be slow.

  • Facing prolem  in Dashboard 4.1, while fetching data from Bex Query

    Hi Exports,
    I am facing an error message  " Failed to (de-)serialise data. (Xsl 000004)"  while fetching data in Dashboard from Bex Query.
    The query is getting connect. while drag n drop some dimensions and measures then going for Refesh or Run Query, geting this error.
    The same query is working fine with other comp like webi n crystal.
    Anybody having solution for this please let me know. I am stuck somewhere.
    Thank You

    Hi,
    Check the data in the infoProvider.Reduce the  Bex query Characteristics & Key figure fields.Try to identify due to which characteristsic adding in Bex Query ,are you facing the issue.Check that characteristic data in the infoProvider.
    Regards,
    Venkat

  • Problem while fetching more records in SAP ABAP report program

    Hello Frinds,
    I have SAP ABAP report program which fetches data from usr02 table
    Now, program is working fine with less number of records, bot in production there are more than 200000 records and either report gets timed out or there is run time error like buffer area not available.
    Below is the fetch statement
    SELECT bname FROM usr02 INTO TABLE lt_user
    So, do I need to take records in small chunks, I do not think it is needed as I have worked on number of othere databases where there are number of records in single fetch statement and database itself take care of this.
    Please provide me some approach to resolve this problem.

    This will be very difficult for you.....
    Since you are getting a time out error....it looks like, you are runnning this report in foreground....................
    Try running it in background it will work...
    ELSE....you have to fetch in small chunks....but the question is how will you do it. Since the USR02 only has BNAME as primary key...
    Either put the BNAME as part of selection screen and fetch the data.....it will solve your problem....
    Only fetch for those BNAME which is entered in the selection screen...
    Hope it helps!

  • Select * from (select * from.....) ........problem

    Hi all!
    I am facing a prob while designing a query:
    I have a table named ind_mtr with column named "seq_no"....seq_no has a unique index.
    I want to arrange the data by seq_no in desc order and from arranged data i want to select first 500 records. For this purpose i supplied the following query:
    select seq_no from (select seq_no from ind_mtr where rownum<501)
    order by seq_no desc;
    But it is giving me wrong results...it selects first 500 records in database and then arranges them in desc order with respect to seq_no.
    Can anybody tell me how can i solve this...
    Riaz

    Since the 1st 500 rows in descending order on seq_id represents the 500 max values of seq_id, you really want something like the following: SELECT * FROM <tablename> where seq_id BETWEEN ( SELECT MAX( seq_id ) - 500 FROM <tablename> ) AND (SELECT MAX(seq_id) FROM <tablename> ); Or you could put into 2 queries in anonymous block. There is probably a better way. You should look into SQL For Smarties and SQL Puzzles and Answers by Joe Celko. Hope this helps.

  • Select in FROM clause not working

    Hello,
    I have three tables with one table containing the name of the other two tables and i want to select dynamically the two selects based on their ID that matches in the first table.
    CREATE TABLE_NAMES (ID NUMBER, TableName VARCHAR(2) )
    CREATE TRADE (activites VARCHAR(2), TRADE_ID )
    CREATE CONTRACT(activites VARCHAR(2), TRADE_ID )
    INSERT INTO TABLE_NAMES ( 101, 'TRADE' );
    INSERT INTO TABLE_NAMES ( 202, 'CONTRACT' );
    INSERT INTO TRADE ('TRADE 1' , 101 )
    INSERT INTO CONTRACT ('CONTRACT 1' , 202 )
    What I wanted to do is select the table name dynamically based up on the id in TABLE_NAMES
    and I failed when doing this
    SELECT SELECTED_TABLE.activites FROM ( SELECT TABLE_NAME FROM TABLE_NAMES WHERE ID = 101 ) SELECTED_TABLE
    OR a more generic form with JOIN statement also did not work
    SELECT SELECTED_TABLE.activities FROM TABLE_NAMES SELECTION JOIN ( SELECT TABLE_NAME FROM TABLE_NAMES) SELECTED_TABLE
    ON SELECTION.ID = SELECTED_TABLE.TRADE_ID
    Thanks in advance

    What you are trying to do will not work. To accomplish your requirement you would have to use dynamic SQL.
    However, I want to stress that this is probably not a good design decision because:
    1. Maintainability of the code may be jeopardized
    2. Dynamic SQL could be laden with SQL injection vulnerabilities
    3. Dynamic SQL generally does not perform as well as static SQL.
    HTH!

  • Error while selecting NULL value from Popup Key LOV(numeric or value error)

    Hi,
    I have a item P1_DEPTNO with following properties.
    P1_DEPTNO - Popup Key LOV (Displays description, returns key value)
    LOV - P1_DEPT_LOV
    select deptname d, deptno r from deptP1_DEPTNO item properties
    List of Values
      Named LOV - P1_DEPT_LOV
      Display Null - Yes // changed to Yes, so that it can accept NULL values.
      Null display value - NULL
      Null return value -   (blank)PL\SQL Process -
    declare
    v1 number;
    begin
    if :P1_DEPTNO is null OR :P1_DEPTNO = '' then
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Now, when I run the page and select NULL value from Popup LOV and submit, I get the following error.
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error.When, I select any other value other than NULL, then it's working perfectly fine.
    Only in case of NULL value, I am getting this error.
    ANY idea, why this error is coming??
    Thanks,
    Deepak

    Hi Varad,
    I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - -1
    but when I select % (null value) from the popup list, it displays the return value -1 in the text field.
    My question is why it is displaying the return value -1 in the text field...*It should display the display value in the text field (i.e blank in this case)*
    then, I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - // a single space, so that when I select %(null value) from the list, it should display blank in the text field...
    then I did the following change in the PL\SQL process.
    PL\SQL process
    declare
    v1 number;
    begin
    if :P1_DEPTNO = ' ' then // -- checking the value of single space ' ' when we select %(null) in the popup list, BUT even I select %(null), control is not coming here.
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Thanks,
    Deepak

  • Error while selecting date from external table

    Hello all,
    I am getting the follwing error while selecting data from external table. Any idea why?
    SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
      2        SE_CUST_ID NUMBER(38),
      3        SE_TRAN_AMT_LCY FLOAT(126),
      4        SE_REVERSAL_MARKER VARCHAR2(255))
      5  ORGANIZATION EXTERNAL (
      6    TYPE ORACLE_LOADER
      7    DEFAULT DIRECTORY ext_tables
      8    ACCESS PARAMETERS (
      9      RECORDS DELIMITED BY NEWLINE
    10      FIELDS TERMINATED BY ','
    11      MISSING FIELD VALUES ARE NULL
    12      (
    13        country_code      CHAR(5),
    14        country_name      CHAR(50),
    15        country_language  CHAR(50)
    16      )
    17    )
    18    LOCATION ('SE2.csv')
    19  )
    20  PARALLEL 5
    21  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> select * from se2_ext;
    SQL> select count(*) from se2_ext;
    select count(*) from se2_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04043: table column not found in external source: SE_REF_NO
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
    HTH -- Mark D Powell --

  • Problem while selecting BELNR from BSEG

    Hi Experts,
    I have a report performance problem while fetching BELNR from BSEG table.
    I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).
    I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.
    Can any one has any other idea or suggestion  or any other way to solve this problem
    Regards,
    Neeraj

    Hi,
    1) Try to create an index on BUZID field
    2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :
    select belnr from bseg appending table itab where buzid = 'M'.
    then do this :
    sort itab by belnr.
    describe itab lines n.
    read table itab index n.
    Please reward if helpful.
    Regards,
    Nicolas.

  • How can we improve the performance while fetching data from RESB table.

    Hi All,
    Can any bosy suggest me the right way to improve the performance while fetching data from RESB table. Below is the select statement.
    SELECT aufnr posnr roms1 roanz
        INTO (itab-aufnr, itab-pposnr, itab-roms1, itab-roanz)
        FROM resb
        WHERE kdauf  = p_vbeln
        AND   ablad  = itab-sposnr+2.
    Here I am using 'KDAUF'  & 'ABLAD' in condition. Can we use secondary index for improving the performance in this case.
    Regards,
    Himanshu

    Hi ,
    Declare intenal table with only those four fields.
    and try the beloe code....
    SELECT aufnr posnr roms1 roanz
    INTO  table itab
    FROM resb
    WHERE kdauf = p_vbeln
    AND ablad = itab-sposnr+2.
    yes, you can also use secondary index for improving the performance in this case.
    Regards,
    Anand .
    Reward if it is useful....

  • Eliminate duplicate while fetching data from source

    Hi All,
    CUSTOMER TRANSACTION
    CUST_LOC     CUT_ID          TRANSACTION_DATE     TRANSACTION_TYPE
    100          12345          01-jan-2009          CREDIT
    100          23456          15-jan-2000          CREDIT
    100          12345          01-jan-2010          DEBIT
    100          12345          01-jan-2000          DEBITNow as per my requirement, i need to fetch data from CISTOMER_TRANSACTION table for those customer which has transaction in last 10 years. In my above data, customer 12345 has transaction in last 10 years, whereas for customer 23456, does not have transaction in last 10 years so will eliminate it.
    Now, CUSTOMER_TRANSACTION table has approximately 100 million records. So, we are fectching data in batches. Batching is divided into months. Total 120 months. Below is my query.
    select *
    FROM CUSTOMER_TRANSACTION CT left outer join
    (select distinct CUST_LOC, CUT_ID FROM CUSTOMER_TRANSACTION WHERE TRANSACTION_DATE >= ADD_MONTHS(SYSDATE, -120) and TRANSACTION_DATE < ADD_MONTHS(SYSDATE, -119) CUST
    on CT.CUST_LOC = CUST.CUST_LOC and CT.CUT_ID = CUST.CUT_IDThru shell script, months number will change. -120:-119, -119:-118 ....., -1:-0.
    Now the problem is duplication of records.
    while fetching data for jan-2009, it will get cust_id 12345 and will fetch all 3 records and load it into target.
    while fetching data for jan-2010, it will get cust_id 12345 and will fetch all 3 records and load in into target.
    So instead of having only 3 records, for customer 12345 it will be having 6 records. Can someone help me on how can i eliminate duplicate records from getting in.
    As of now i have 2 ways in mind.
    1. Fetch all records at once. Which is impossible as it will give space issue.
    2. After each batch, run a procedure which will delete duplicate records based on cust_loc, cut_id and transaction_date. But again it will have performance problem.
    I want to eliminate it while fetching data from source.
    Edited by: ace_friends22 on Apr 6, 2011 10:16 AM

    You can do it this way....
    SELECT DISTINCT cust_doc,
                    cut_id
      FROM customer_transaction
    WHERE transaction_date >= ADD_MONTHS(SYSDATE, -120)
       AND transaction_date < ADD_MONTHS(SYSDATE, -119)However please note that - if want to get the transaction in a month like what you said earlier jan-2009 and jan-2010 and so on... you might need to use TRUNC...
    Your date comparison could be like this... In this example I am checking if the transaction date is in the month of jan-2009
    AND transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)) Your modified SQL...
    SELECT *
      FROM customer_transaction 
    WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27))Testing..
    --Sample Data
    CREATE TABLE customer_transaction (
    cust_loc number,
    cut_id number,
    transaction_date date,
    transaction_type varchar2(20)
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2009','dd-MON-yyyy'),'CREDIT');
    INSERT INTO customer_transaction VALUES (100,23456,TO_DATE('15-JAN-2000','dd-MON-yyyy'),'CREDIT');
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2010','dd-MON-yyyy'),'DEBIT');
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2000','dd-MON-yyyy'),'DEBIT');
    --To have three records in the month of jan-2009
    UPDATE customer_transaction
       SET transaction_date = TO_DATE('02-JAN-2009','dd-MON-yyyy')
    WHERE cut_id = 12345
       AND transaction_date = TO_DATE('01-JAN-2010','dd-MON-yyyy');
    UPDATE customer_transaction
       SET transaction_date = TO_DATE('03-JAN-2009','dd-MON-yyyy')
    WHERE cut_id = 12345
       AND transaction_date = TO_DATE('01-JAN-2000','dd-MON-yyyy');
    commit;
    --End of sample data
    SELECT *
      FROM customer_transaction 
    WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27));Results....
    CUST_LOC     CUT_ID TRANSACTI TRANSACTION_TYPE
          100      12345 01-JAN-09 CREDIT
          100      12345 02-JAN-09 DEBIT
          100      12345 03-JAN-09 DEBITAs you can see, there are only 3 records for 12345
    Regards,
    Rakesh
    Edited by: Rakesh on Apr 6, 2011 11:48 AM

  • Fatal error while fetching data from bi

    hi,
    i am getting following error while fetching data from bi using select statement
    i have written code in this way
    SELECT  [Measures].[D2GFTNHIOMI7KWV99SD7GPLTU] ON COLUMNS, NON EMPTY { [DEM_STATE].MEMBERS} ON ROWS FROM DEM_CUBE/TEST_F_8
    error description when i click on test
    Fatal Error
    com.lighthammer.webservice.SoapException: The XML for Analysis provider encountered an error

    thanks for answering .but when i tried writing the statement in transaction 'MDXTEST' and clicked on check i am getting following error
    Error occurred when starting the parser: timeout during allocate / CPIC-CALL: 'ThSAPCMRCV'
    Message no. BRAINOLAPAPI011
    Diagnosis
    Failed to start the MDX parser.
    System Response
    timeout during allocate / CPIC-CALL: 'ThSAPCMRCV'
    Procedure
    Check the Sys Log in Transaction SM21 and test the TCP-IP connection MDX_PARSER in Transaction SM59.
    SO I WENT IN SM 59 TO CHECK THE CONNECTION.
    CAN U TELL ME WHAT CONFIGERATION I NEED TO DO FOR MAKING SELECT STATEMENTS WORK?

  • Brasero segmentation fault while selecting Plugins from menu

    Hello,
    Brasero is seg faulting for me when I select Plugins from the File menu. I am running a standard Gnome DE 3.12.2 with startx to login. When I launch brasero from terminal, it tells me:
    [bryan@nas ~]$ brasero
    (brasero:5300): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
    (brasero:5300): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
    and then once I click Plugins it says additionally:
    (brasero:5300): GLib-GObject-CRITICAL **: g_type_instance_get_private: assertion 'instance != NULL && instance->g_class != NULL' failed
    Segmentation fault
    Brasero version is 3.11.3
    Any ideas what causes this problem?
    Pacman -Syu is done before posting this message...
    Thanks

    Upstream bug report: https://bugzilla.gnome.org/show_bug.cgi?id=728376

Maybe you are looking for