当前位置:   article > 正文

postgres function: COALESCE_func.coalesce

func.coalesce

COALESCE

  1. COALESCE
(value [, ...])

The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:

SELECT COALESCE(description, short_description, '(none)') ...

Like a CASE expression, COALESCE only evaluates the arguments that are needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. This SQL-standard function provides capabilities similar to NVL and IFNULL, which are used in some other database systems.


TD中zeroifnull函数可用本函数替代:coalesce(arg,0),在notepad++中替换的正则表达式:

zeroifnull([\s\w\.]+)

替换为:

COALESCE(\1,0)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/974650
推荐阅读
相关标签
  

闽ICP备14008679号