I'm bewildered by a query in Oracle which is returning in a seemingly random order.
SELECT
Date,
Amount
FROM MyTable
WHERE Date = '26-OCT-2010'
ORDER BY Date
This returns the following data:
| Date | Amount
--------------------------
1 | 26-OCT-10 | 85
2 | 26-OCT-10 | 9
3 | 26-OCT-10 | 100
I cannot fathom why the database returns the data in this specific order, or why, since the original table would return the data this way.
Casting Date
to TIMESTAMP
confirms that all Date
values are the same value - 26-OCT-10 00.00.00.000000000
, therefore, I can' rule out that there is a difference in the values. However, when I do this, the rows return in the order of 1, 3, 2.
This is driving me mad so it would really help soothe me if someone could provide an explanation as to why this is.
I would expect this to return in a different order every time the query is run, given that the order conditional is identical on every row (thus leaving the ordering to pure chance).
Many thanks in advance.