col1
1
2
3
4
5
6
输出:
col2
2
3
4
5
6
null
使用LEAD
解析函数:
SELECT col1,
LEAD(col1) OVER (ORDER BY col1) AS col2
FROM table_name;
对于样本数据:
CREATE TABLE table_name (col1) AS
SELECT LEVEL FROM DUAL CONNECT BY LEVEL <= 6;
输出:
<表类>tbody><<tr> COL1 COL2 1 2 23 4 3 4 5 5 6 6 表类>