转自:https://jingyan.baidu.com/article/9989c74604a644f648ecfef3.html
SELECT ROW_NUMBER() OVER(PARTITION BY ta.Process_Instance_Id ORDER BY nvl(ta.status, 'D') ASC, nvl(ta.finish_date, ta.start_date) DESC) AS ROW_INDEX,
ta.*
FROM warn_task ta;
2、
row_number() OVER (PARTITION BY COL1 ORDER BY COL2) 表示根据COL1分组,在分组内部根据 COL2排序,而此函数计算的值就表示每组内部排序后的顺序编号(组内连续的唯一的)
这里先根据Process_Instance_Id分成若干连续的组;
类似的方法还有dense_rank()和rank over(),
参见:https://www.cnblogs.com/YuyuanNo1/p/7929543.html