The Oracle database fuzzy query statement is a result that is easy to ignore: Empty records

Source: Internet
Author: User

Cause:

The SQL statement is as follows:

Select count (*) from test;

Result 1390.

Select count (*) from test where BB not like '% disable %'

Result 393.

In the actual browsing process, it is found that the result set is not disabled and there are certainly more than 393 records.

Process:

1. First, we suspect that the character set of the client does not match the server character set.

After the preceding SQL statement is used on another machine, the results are the same.

2. I still suspect that it is a character set problem. I have not found the real cause of the problem, and almost went crazy.

3. I accidentally found that many BB fields are empty. After careful analysis, I found that bb not like '% disabled %' does not match null records, so I changed it

Select count (*) from test where BB not like '% disable %' or BB is null

The result is 1356.

Conclusion:

Fuzzy match is not often used, so it will lead to careless use, and eventually lead to human madness.

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.