Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> OPTIMIZER_HINT, FIRST_ROWS, and MAX

OPTIMIZER_HINT, FIRST_ROWS, and MAX

From: <athaung_at_gmail.com>
Date: Fri, 09 Nov 2007 14:43:00 -0800
Message-ID: <1194648180.079344.243280@57g2000hsv.googlegroups.com>


I am getting completely different results with the following query:

SELECT scanA.* FROM
SCHEDWIN.LOCSCAN scanA WHERE scanA.SCAN_TIME = ( SELECT MAX(scanB.SCAN_TIME)
FROM SCHEDWIN.LOCSCAN scanB WHERE scanA.RESID||scanA.LIBENTRYID = scanB.RESID||scanB.LIBENTRYID AND
(scanB.SCAN_TIME < ' 1194645483' ) );

...depending on whether I have OPTIMIZER_HINT set to CHOOSE or FIRST_ROWS!
(CHOOSE returns the correct result set, FIRST_ROWS returns nothing.)

Can anyone explain why this might be happening and how I can get my desired result set with the CHOOSE option?

I am trying to select all the records (for a given RESID/LIBENTRYID combination) that are the LATEST records (according to the SCAN_TIME field) before a certain cutoff value.

Thank you!
-Aung Received on Fri Nov 09 2007 - 16:43:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US