问题描述
我使用oracle 11g.下面的行顺序是空的
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"
推荐答案
ROW_NUMBER()
的OVER()
子句需要ORDER BY
使用ORDER BY NULL
是一种解决方法,它满足了语法要求,但实际上并未更改数据的顺序.实际上,这是完全不订购的指令.
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.
NB :有些人(包括我自己)更喜欢使用SELECT 1
而不是SELECT NULL
,但是效果没有差别.
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.
提示:TSQL不允许直接使用SELECT 1,但是您可以使用(SELECT 1)
tip: TSQL does not permit the direct use of SELECT 1, but you may use (SELECT 1)
这篇关于这是什么意思“按NULL排序"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!