神奇的IGNORE NULLS

当前行为NULL,想找出该列上一个不为NULL的值,怎么办呢,用IGNORE NULLS吧

该方法学自 QQ群内小翁先生(625276799)

Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 
Connected as [email protected]/orcl
 
SQL> 
SQL> SELECT id,
  2         text,
  3         last_value(text IGNORE NULLS) over(ORDER BY id) as new_text
  4    FROM t3;
 
        ID TEXT          NEW_TEXT
---------- ------------- ---------------
         1 a             a
         2               a
         3               a
         4 b             b
         6               b
         7 d             d
         8               d
 
7 rows selected
 
SQL> 


你可能感兴趣的:(分析函数,小技巧)