[Developer] NVL,NVL2,NULLIF,COALESCE,DECADE,CASE

tolilong發表於2016-02-20
記錄一下NVL,NVL2,NULLIF,COALESCE,DECADE,CASE 函式的意思:

nvl(v1,v2)     if v1 is null then result=v2 else result=v1 end
nvl2(v1,v2,v3) if v1 is null then result=v3 else result=v2 end
nullif(v1,v2)  if v1=v2 then result=null else result=v1 end
coalesce(v1,v2,.....vn) return the first not null value.
decode(col1,v1,r1,v2,r2,.....,rn)  if col1=v1 then result=r1 else if col1=v2 then result=r2........else result=rn.
case when .... then .... end as colname.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1991572/,如需轉載,請註明出處,否則將追究法律責任。

相關文章