Oracle nvl Functions

Source: Internet
Author: User

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and a.jbfl= nvl('',a.jbfl);

16

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and a.jbfl= nvl(a.jbfl,'*');

16

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and a.jbfl= nvl('',nvl(a.jbfl,'*'));

16

The results returned by these three statements are identical, although

1.nvl('',a.jbfl)
2.nvl(a.jbfl,'*')
3.nvl('',nvl(a.jbfl,'*'))

The results returned by the three functions are different. The first function does not return ''. The second and third functions may return ''. However, the left expression A. jbfl of the three functions cannot take null values, so this condition will never have the ''condition.

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and nvl('',a.jbfl)= nvl('',a.jbfl);

16

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and nvl(a.jbfl,'*')= nvl(a.jbfl,'*');

17

select *  from ylfwzb.doubt_info a where a.dxlx = '2'   and a.dxid = '90990'   and a.gzid = '1000000000000001'   and nvl('',nvl(a.jbfl,'*'))= nvl('',nvl(a.jbfl,'*'));

17

When the left expression may take '', the result is 17, that is, the row where a. jbfl ='' is obtained. You only need to analyze the nvl returned results.

Related Article

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.