Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MAX() behaviour with ROWNUM

161459Mar 18 2003 — edited Mar 18 2003
We use a period/week calendar which has weeks like 03P01W1, 03P01W2 etc
I have a query to find the week +2 of the week specified.
It looks like this:
SELECT max(Week_Id)
FROM Week
WHERE Week_Id > '03P05W1'
AND ROWNUM <= 2
The where clause should limit the result set to:
03P05W2 and 03P05W3
The MAX function then picks out 03P05W3 as the highest (and so furthest in the future).

This runs on 2 'identicle' databases, a test and production.
However, on one of the databases it returns 04P13W5, which is the last entry in the table.

Any ideas why ?!?!?!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2003
Added on Mar 18 2003
3 comments
859 views