Oracle uses the in event

Source: Internet
Author: User

Today, I found a strange problem when I wrote an oracle statement. I had to find the cause for a long time. Ask Daniel for help. The problem is simplified as follows:

Select seq, info, topic from system. Help where seq in (select distinct seq from system. Help where seq = 20); ----- (1)

There is a large gap between the results obtained from select seq, info, and topic from system. Help where seq in (20) ------ (2.

We all know that the result of select distinct seq from system. Help where seq = 20 is of course 20. From the statement perspective, (1) and (2) should be equivalent, but (2) the query result is correct, with only 10 rows, but (1) in seq, there are not only 20 corresponding row values, but also many rows with seq as 0 and the number of rows is 500 ...... (Khan, where do these 0 numbers come from? The help table has 71 rows in total. The help table is available in the Oracle sample database)

Select seq, info, topic from system. help where seq = (select distinct seq from system. help where seq = 20); ----- (3) This sentence is the same as (2) and can get the correct result.

Then I tested it on other people's computers. (1) The statement is the same as (2 ...... Shenma situation ...... Why is my computer unavailable?

On my computer (1) Is it wrong? Configuration problems? Or statement problems? If you have any answers, you can answer my blog. You can use garden beans.

Http://home.cnblogs.com/q/26334/

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.