Talking about mysql which can have nvl functions similar to oracle, oraclenvl

Source: Internet
Author: User

Talking about mysql which can have nvl functions similar to oracle, oraclenvl

Use ifnull instead of isnull

Isnull is used to determine whether it is null. If the returned value is 1, it indicates null or 0, it indicates not null.

Ifnull is equivalent to the nvl of oracle. Its usage is as follows:

Mysql> select ifnull (1, 10 );
+ -------------- +
| Ifnull (1, 10) |
+ -------------- +
| 1 |
+ -------------- +
1 row in set (0.00 sec)

Mysql> select ifnull (null, 10 );
+ ----------------- +
| Ifnull (null, 10) |
+ ----------------- +
| 10 |
+ ----------------- +
1 row in set (0.00 sec)


Isnull is used as follows:

Mysql> select isnull (null );
+ -------------- +
| Isnull (null) |
+ -------------- +
| 1 |
+ -------------- +
1 row in set (0.00 sec)

Mysql> select isnull (1 );
+ ----------- +
| Isnull (1) |
+ ----------- +
| 0 |
+ ----------- +
1 row in set (0.00 sec)

In the above discussion, mysql can have all the content shared with you by the nvl function similar to oracle. I hope to give you a reference and support for the customer's house.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.