Postgres function for NVL

605 viewsPostgreSQLPostgreSQL Postgressql
0

When I use the nvl function, I receive the following error. Please advise.

dev_db=> SELECT nvl( sum(salary), 0 ) as b FROM db.employee WHERE user = ‘testuser’;
ERROR: function nvl(numeric, integer) does not exist
LINE 1: SELECT nvl( sum(salary), 0 ) as b FROM db.employee

 

 

Manohar Changed status to publish August 25, 2022
Add a Comment
0

The coalesce functions in PostgreSQL are supported but not the NVL functions. Similar to Oracle, this method is used. Converting NVL and using Oracle’s coalesce operations are both possible with coalesce. The arguments must be of the same type or be capable of being automatically typed into the same type.

Solution : NVL function should be changed to COALESCE.

Manohar Changed status to publish August 25, 2022
Add a Comment
Write your answer.