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.


Author: sqlandplsql

To learn more about the Oracle, SQL, PL SQL, Performance Tuning, Database Modeling, Ubuntu, MySQL etc .Suggestions, comments, feedbacks and referrals are highly appreciated.

2 thoughts on “Oracle NVL equivalent in MySQL”

Leave a 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 )

Google+ photo

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

Connecting to %s