View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Hi,
I have issued an select query with where clause like,
select * from tbname where empid =1234 with ur;
where empid is one of the index of the table.
The SQLCODE returned for the above sql is +100. But the data is available in the table which i can browse through file-aid.
when i asked what could be the reason for this anomaly? Our DBA said this is due to inconsistency in indexes. please explain more about/ chances of getting the inconsistency in indexes.
Thanks,
Murali. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
I don't see how this has anything to do with the presence/absence of whatever "inconsistency of indexes" means. +100 means exactly what the manual says it means -- no rows met the WHERE clause criteria. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Terry,
What manual says is correct,but this is the first i saw these kind of abnormality. If it is not with 'inconsistency of index' then what could be the reason for it????????
Thanks,
Murali |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
an easy test to make would be construct a WHERE clause that would force a table scan. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Dick,
To add salt to the wound, the total count of rows displayed (in IBM DB2 Administration Tool (DB2 Catalog Front End)) is different from select count(*) from tbname. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if you have dba's telling you that there are inconsistancies in the indexes
READ: incompetent DBA's who can't maintain a database,
why would you think that anything associated with the table is accurate? |
|
Back to top |
|
|
notonly4u
New User
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Do you have same table in different DB2 sub systems?
You may be executing the Select query in one and file-aid in some other sub system.
Pls check |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Dick,
Since we are getting the sqlcode +100 for a test data in development region, which brought this anomaly, i posted the question to get what could be the scenario? why it happens, does codd's rule fails in db2 or these DBA's faults leading to failure. Simplhy to know why it happens.
Thanks notonly4u.
But the subsytem, qualifier, database name,table space,schema everything are the same. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
pkmurali,
Quote: |
To add salt to the wound, the total count of rows displayed (in IBM DB2 Administration Tool (DB2 Catalog Front End)) is different from select count(*) from tbname. |
statistics may not be updated.
Show us the records from the table using qmf or spufi.
Sushanth |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
if only I got a dime for every nitwit how claims he found a glitch in DB2 ...
Maybe you should start with
- making sure you're selecting from the same table
- verifying column types and actual values of what is in the table.
- then reread you sql 3 times |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
"select * from tbname where empid =1234 with ur; "
How is empid defined? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
The SQLCODE returned for the above sql is +100. But the data is available in the table which i can browse through file-aid. |
Is the +100 happening in spufi? Did you see a message like:
Code: |
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 |
? |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
All,
The SQLCODE +100 is returned when i executed the query in SPUFI. Yes Dick that's the message i got when i executed in SPUFI. empid is index
column.
Code: |
select count(*) from a1jnbyn.tbname;
------------------
6102
1 record(s) selected.
sel owner Name T DB Name TS Name Cols Rows Che
A1JNBYN TWC1C00 T DWC1T003 RWC1C00 97 44587104
|
The Problem got resolved by rebuilding the index,before rebuilding the index they identified that column has duplicate entries and after removing the duplicates they created the unique index for column empid.Now i can get the result for my select query.
But what gives the solution is not clear. By identifying the duplicates, and deleting the duplicates and creating unique index would done the job?? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I rechecked :
The only way to accomplish this is by repairing an index that is rebuild pending.
Which sounds like what you've done : trying to create a unique index on duplicate data, the build failed and you (or dba) force repaired it.
Of course you get unpredictable results. |
|
Back to top |
|
|
|