Question

I encountered an rather strange situation on two Oracle 11 DB-Hosts, that i cannot reproduce anywhere else:

Given a rather simple table:

CREATE TABLE TESTTABLE ( XID NUMBER(10) NOT NULL,
                         XSTRING CHAR(14 BYTE) NOT NULL,
                         XDATE DATE NOT NULL )
LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING;

Filled with rather simple data:

INSERT INTO TESTTABLE(XID, XSTRING, XDATE)
VALUES(1119870, 'R008505       ', TO_DATE('08/01/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));

Then this query:

SELECT * 
  FROM TESTTABLE
 WHERE xstring='R008505'
   AND (xdate >= SYSDATE OR xdate < '01.01.1900');

Returns the only row in the table (which is of course wrong), while the following query (with the SYSDATE-line swapped) returns 0 rows:

SELECT * 
  FROM TESTTABLE
 WHERE xstring='R008505'
   AND (xdate < '01.01.1900' OR xdate >= SYSDATE);

Using TRUNC(SYSDATE) does not make any difference here.

How this could happen and how to fix this issue?

Was it helpful?

Solution

This looks very similar to a previous question, which is possibly related to bug 9495697, though it wasn't confirmed in that case. I can't share the bug details from MOS, but someone else has already done so.

As in that case, the symptoms you're experiencing on the base 11.2.0.1 release don't manifest for me on 11.2.0.3, or on SQL Fiddle, which is running 11.2.0.2.

If it is that bug then applying the 11.2.0.2 patch set should cure it, or a patch is available for just this issue; not sure if you need to raise a service request and get confirmation that the symptoms do match that specific bug before applying the patch though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top