问题
I am looking for a quick way to do
SELECT IFNULL(columna, columnb) FROM mytable
(I have dozens of columns and don't want to write a case for each of them)
回答1:
You can also use the standard COALESCE
keyword, which allows you to pass it multiple parameters:
SELECT COALESCE(columna, columnb, ..., columnz) FROM mytable
COALESCE keyword documentation
回答2:
just found out:
SELECT nvl(columna, columnb) FROM mytable
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions105.htm
来源:https://stackoverflow.com/questions/31409990/oracle-equivalent-of-mysql-ifnull-no-case-no-if