i use oracle 11g.what does the line order by null means in the following
select f_value,row_number() over (order by null) as id
from tableName"
The OVER()
clause for ROW_NUMBER()
requires an ORDER BY
using ORDER BY NULL
is a workaround that satifies the syntax requirement but does not actually change the order of the data. In effect it is an instruction to not order at all.
N.B.: some (myself included) prefer to use SELECT 1
instead of SELECT NULL
but there is no difference in effect.
Bottom line: not great, but it works.
tip: TSQL does not permit the direct use of SELECT 1, but you may use (SELECT 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With