Tuesday, December 11, 2012

NVL() function in Postgre SQL

Do Postgre have any function that equals to NVL() of Oracle? of course, it do have the same function but with different name. Below is the systax:


coalesce(expr1, expr2, expr3,....)
 this function’ll returns the first non-null expression that is passed to it.

1Ex: 
2SELECT coalesce(<column name 1>, <New value>), <Column name 2>
3FROM <Table name>
4WHERE <Some Condition>

If <Column name 1> is NULL, it’ll be replaced by <New value>

No comments:

Post a Comment