if(condition, then, else) in Oracle

后端 未结 6 2596
甜味超标
甜味超标 2021-02-20 01:15

MySQL/MSSQL has a neat little inline if function you can use within queries to detect null values, as shown below.

SELECT

...

foo.a_field AS \"a_field\",
SELEC         


        
6条回答
  •  别那么骄傲
    2021-02-20 01:48

    Use the standard COALESCE function:

    SELECT COALESCE(foo.bar, 0) as "bar", ...
    

    Or use Oracle's own NVL function that does the same.

提交回复
热议问题