row_number()用法:
ROW_NUMBER is an analytic function. It assigns a unique number to each row to
which it is applied (either each row in the partition or each row returned by the
query), in the ordered sequence of rows specified in the order_by_clause,
beginning with 1.
You cannot use ROW_NUMBER or any other analytic function for expr. That is, you
can use other built-in function expressions for expr, but you cannot nest analytic
functions.
SQL> select a.*,row_number() over (order by nu) as rn from test a;
NU RN---------- ----------
1 1
1 2
1 3
2 4
3 5
4 6
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7185131/viewspace-1016115/ ,如需转载,请注明出处,否则将追究法律责任。