I have the following table which has >13.000 rows.
CREATE TABLE "DBA"."mytable" (
"c1" numeric(8,0) NOT NULL,
"c2" numeric(2,0) NOT NULL,
"c3" numeric(4,0) NOT NULL,
"c4" numeric(8,0) NOT NULL,
PRIMARY KEY ("c1","c2","c3","c4")
)
The following query returns no rows when there are at least two rows that happen to meet the condition:
select * from mytable A where A.c1=229 and A.c3=1
More strangely, a slightly modified (but same) version of the query returns 2 rows as expected:
select * from mytable A where A.c1=229 and A.c3+1=2
Having suspected there is some physical corruption in the db, I have created a new db, created the table with the above code and loaded values from an unload file. The results are the same.
I know all four columns in PK is not good design, but this shouldn't be an excuse for the db to return wrong results. By playing with the column creation order and dropping the PK the problem disappears and reappears.
Does aynbody know a fix or some workaround about this problem? The DB is on a Windows 8 64-bit system, the locale is Turkish.
Thanks