It looks like you want lead()
:
select col1,
lead(col1) over (order by col1) - 1
from t;
If you want 395
as the final value, you can add a default value:
select col1,
lead(col1, 1, 396) over (order by col1) - 1
from t;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…