Oracle DataReader

G

Guest

I am having a problem with the Oracle DataReader. The issue is that when I have a text field which has the exact same value for a particular field, the datareader is returning garbage in the second and subsequent rows for that value.

Say for instance I have a field called "Description" and in the 7th, 8th and 9th row, the value of "Description" is "Bird Dog". When I read the 7th record and examine the contents of "Description" is see "Bird Dog", but when I read and examine the contents of record 8, I see somethin like the following: "Bir\0 \0\0\0". I see the exact same "garbage" for the 9th row. When I get to the 10th row, it the value returned is what is expected.

This happens on a consistent basis accross a variety of different records being retrieved.

I have run the query in TOAD and examined the results and they are as they should be in "Toad", but when I run that same query in ADO.Net, my results are goofy.

Has anyone experienced this problem? Is there a cure?
 
P

Paul Clement

¤ I am having a problem with the Oracle DataReader. The issue is that when I have a text field which has the exact same value for a particular field, the datareader is returning garbage in the second and subsequent rows for that value.
¤
¤ Say for instance I have a field called "Description" and in the 7th, 8th and 9th row, the value of "Description" is "Bird Dog". When I read the 7th record and examine the contents of "Description" is see "Bird Dog", but when I read and examine the contents of record 8, I see somethin like the following: "Bir\0 \0\0\0". I see the exact same "garbage" for the 9th row. When I get to the 10th row, it the value returned is what is expected.
¤
¤ This happens on a consistent basis accross a variety of different records being retrieved.
¤
¤ I have run the query in TOAD and examined the results and they are as they should be in "Toad", but when I run that same query in ADO.Net, my results are goofy.
¤
¤ Has anyone experienced this problem? Is there a cure?

What is the data type of the Oracle column?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

In Oracle column is a Varchar2(60) and I am using the dr.GetString() method to read the data.
 
J

Jon Skeet [C# MVP]

Jim Heavey said:
In Oracle column is a Varchar2(60) and I am using the dr.GetString()
method to read the data.

Are you checking whether or not the value is null (using IsDBNull)
before fetching it?
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

I would shift to ODP.NET (free download from Oracle TechNet
(otn.oracle.com)). It is much better suited to Oracle databases than the
OracleClient. I use OracleClient with DataSets, so I have not experienced
what you are running into.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
Jim Heavey said:
I am having a problem with the Oracle DataReader. The issue is that when
I have a text field which has the exact same value for a particular field,
the datareader is returning garbage in the second and subsequent rows for
that value.
Say for instance I have a field called "Description" and in the 7th, 8th
and 9th row, the value of "Description" is "Bird Dog". When I read the 7th
record and examine the contents of "Description" is see "Bird Dog", but when
I read and examine the contents of record 8, I see somethin like the
following: "Bir\0 \0\0\0". I see the exact same "garbage" for the 9th row.
When I get to the 10th row, it the value returned is what is expected.
This happens on a consistent basis accross a variety of different records being retrieved.

I have run the query in TOAD and examined the results and they are as they
should be in "Toad", but when I run that same query in ADO.Net, my results
are goofy.
 
G

Guest

I know that the value will not be null. As I indicated, I checked the values in TOAD first and compared those with the values returned by ADO.Net.
 
P

Paul Clement

¤ In Oracle column is a Varchar2(60) and I am using the dr.GetString() method to read the data.
¤

I don't seem to be able to repro the behavior. Is there a BLOB or CLOB data type in your query?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
P

Paul Clement

On Wed, 23 Jun 2004 08:26:04 -0500, "Cowboy \(Gregory A. Beamer\) [MVP]"

¤ I would shift to ODP.NET (free download from Oracle TechNet
¤ (otn.oracle.com)). It is much better suited to Oracle databases than the
¤ OracleClient. I use OracleClient with DataSets, so I have not experienced
¤ what you are running into.

Of course you do need to be using the 9i client software.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
P

Paul Clement

¤ Here is the script for creating my table.
¤
¤ DROP TABLE OPS_SCORECARD_ARCHIVE CASCADE CONSTRAINTS ;
¤
¤ CREATE TABLE OPS_SCORECARD_ARCHIVE (
¤ FAMILY_SORT NUMBER (4),
¤ PROD_SORT NUMBER (4),
¤ METRIC_CAT_SORT NUMBER (3),
¤ METRIC_SORT NUMBER (4),
¤ PM_NAME VARCHAR2 (255),
¤ PRESENTER_NAME VARCHAR2 (255),
¤ PDM_NAME VARCHAR2 (255),
¤ FAMILY VARCHAR2 (50),
¤ PROD_NAME VARCHAR2 (50),
¤ PAGENUMBER VARCHAR2 (4),
¤ PRODUCT_ID NUMBER (6),
¤ METRIC_CAT VARCHAR2 (60),
¤ PM_COMMENT VARCHAR2 (255),
¤ PDM_COMMENT VARCHAR2 (255),
¤ METRIC VARCHAR2 (50),
¤ TGT_ACHIV_METHOD VARCHAR2 (10),
¤ DATA_SUM_METHOD VARCHAR2 (10),
¤ DATA_FORMAT VARCHAR2 (10),
¤ D_M_1 VARCHAR2 (100),
¤ DATA_MN_1_EST VARCHAR2 (1),
¤ T_M_1 VARCHAR2 (100),
¤ AT_M_1 VARCHAR2 (100),
¤ D_M_2 VARCHAR2 (100),
¤ DATA_MN_2_EST VARCHAR2 (1),
¤ T_M_2 VARCHAR2 (100),
¤ AT_M_2 VARCHAR2 (100),
¤ D_M_3 VARCHAR2 (100),
¤ DATA_MN_3_EST VARCHAR2 (1),
¤ T_M_3 VARCHAR2 (100),
¤ AT_M_3 VARCHAR2 (100),
¤ D_Q_1 VARCHAR2 (100),
¤ AT_Q_1 VARCHAR2 (100),
¤ T_Q_1 VARCHAR2 (100),
¤ D_Q_2 VARCHAR2 (100),
¤ T_Q_2 VARCHAR2 (100),
¤ AT_Q_2 VARCHAR2 (100),
¤ D_Q_3 VARCHAR2 (100),
¤ T_Q_3 VARCHAR2 (100),
¤ AT_Q_3 VARCHAR2 (100),
¤ D_Q_4 VARCHAR2 (100),
¤ T_Q_4 VARCHAR2 (100),
¤ AT_Q_4 VARCHAR2 (100),
¤ D_YTD VARCHAR2 (100),
¤ T_YTD VARCHAR2 (100),
¤ AT_YTD VARCHAR2 (100),
¤ ASOF_MONTH VARCHAR2 (12),
¤ C_M_1 VARCHAR2 (1),
¤ C_M_2 VARCHAR2 (1),
¤ C_M_3 VARCHAR2 (1),
¤ C_Q_1 VARCHAR2 (1),
¤ C_Q_2 VARCHAR2 (1),
¤ C_Q_3 VARCHAR2 (1),
¤ C_Q_4 VARCHAR2 (1),
¤ C_YTD VARCHAR2 (1),
¤ ACHIV_M1 VARCHAR2 (100),
¤ ACHIV_M2 VARCHAR2 (100),
¤ ACHIV_M3 VARCHAR2 (100),
¤ ACHIV_Q1 VARCHAR2 (100),
¤ ACHIV_Q2 VARCHAR2 (100),
¤ ACHIV_Q3 VARCHAR2 (100),
¤ ACHIV_Q4 VARCHAR2 (100),
¤ ACHIV_YTD VARCHAR2 (100),
¤ REPORT_MONTH VARCHAR2 (12),
¤ REPORT_YEAR NUMBER (4))
¤ TABLESPACE MED_DATA_DSS_01
¤ PCTFREE 10
¤ PCTUSED 40
¤ INITRANS 1
¤ MAXTRANS 255
¤ STORAGE (
¤ INITIAL 4096000
¤ NEXT 4096000
¤ PCTINCREASE 0
¤ MINEXTENTS 1
¤ MAXEXTENTS 2147483645
¤ FREELISTS 1 FREELIST GROUPS 1 )
¤ NOCACHE;
¤
¤
¤ CREATE INDEX IDX_SCORECARD_ARCHIVE_1 ON
¤ "PRG_OPS".OPS_SCORECARD_ARCHIVE(REPORT_MONTH, REPORT_YEAR)
¤ TABLESPACE MED_DATA_DSS_01 PCTFREE 10 STORAGE(INITIAL 4096000 NEXT 4096000 PCTINCREASE 0 )
¤ ;

I don't see anything out of the ordinary. Does the problem always affect the exact same data or is
it arbitrary? Do you see the same problem with the DataAdapter?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top