Oracle NVL equivalent in MySQL

Read – What is Oracle NVL

Many Oracle Developers who write code in MySQL will look for this solution.

Answer 1 :- IFNULL

Answer 2 :- COALESCE ( It returns first not null expression in the list)


mysql> select IFNULL(null,1);
will return 1


mysql> select COALESCE(null,1);
will return 1

Note:- COALESCE will work in Oracle too.

2 responses to “Oracle NVL equivalent in MySQL”

  1. Oracle NVL Function replace NULL values with a given value in the result of a query. Oracle NVL Function takes two parameters. If expression of first parameter is not null then NVL returns the expression of first parameter, otherwise returns the expression of second parameter. See details:

  2. great insight. Really enjoyed reading this blog. Keep up the good work and to everyone keep on learning!

Leave a Reply to Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: