Use coalesce oracle Postgresql achieve a similar method to NVL

COALESCE (expression_1, expression_2, ...,expression_n)
In turn refer to each parameter expression, non-null value encountered is stopped and returns the value.
If all the expressions are null, it will eventually return a null value.
Use COALESCE expression contains a null value that most will eventually return a null value.

SELECT coalesce(collect_result,0) as collect_result  FROM collect 

Database queries collect_result If the field is empty then assigned 0 to collect_result.



Author: Devid
link: https: //www.jianshu.com/p/b0f6c574274b
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

Guess you like

Origin www.cnblogs.com/telwanggs/p/11386743.html