更新时间:2023-01-20 20:38:34
这是因为每一行都调用dbms_random()
,因此它可以生成重复的结果.相反,如果您要随机排一行,请尝试如下操作:
That is because dbms_random()
is called for each row, so it can generate duplicate results. Instead, if you want one random row, try something like this:
select tid
from (select tid,
row_number() over (order by dbms_random.value()) as seqnum
from Train
) t
where seqnum = 1;
这将始终返回具有"seqnum = 1"的行,但它将是随机的tid
.
This will always return the row with "seqnum = 1", but it will be a random tid
.