Learning inline view embedded view

Source: Internet
Author: User

The inline view embedded view is called the inline view, which is also called the inline view. To put it bluntly, it is the view created during execution. For example, select... from (select... from (select ...)), the select statement used as the from Table creates an embedded view. In my personal understanding, it is embedded because it is placed in a statement and can be nested multiple times, however, this embedded VIEW can only be used in the current SQL statement. It cannot be used as repeatedly as the VIEW created by CREATE VIEW. It is not an actual object. Let's take a look at the definition of Concept: Inline ViewsAn inline view is not a schema object. it is a subquery with an alias (correlation name) that you can use like a view within a SQL statement. I think it is an SQL usage technique, so that you do not need to CREATE a VIEW without creating a VIEW. Instead of maintaining it, you only need to use nesting in SQL, you can use a view to encapsulate the query results. Let's take a look at the introduction of inline view on MOS. Locate a SELECT With An inline view Fails With ORA-600 [9999] (Document ID 1068871.1), pointing to a bug in 11.1.0.7.

The query---------select count(*)   from (select count(*) as numLLEids           from LaborLevelEntry            where ((upper(NAME) = upper( N'Division2')                 AND LABORLEVELDEFID = 1 AND inActive=0)                OR (upper(NAME) = upper( N'Department999999')                 AND LABORLEVELDEFID = 2 AND inActive=0))           group by laborleveldefid) numrows ;11.1.0.6: (good results)  COUNT(*)----------        211.1.0.7: (wrong results)  COUNT(*)----------         1         1Disabling view merging in 11.1.0.7 we got the good results.

 

In this version of Oracle, the result of the inline view query above is the grouping style. If the implicit parameter _ simple_view_merging is disabled, the correct result is displayed, alternatively, you can Patch 8327137 for this version. Find a 10 Gb library and see that the implicit parameter _ simple_view_merging is TRUE, which is enabled by default. (As Mr. Bai said, the knowledge points captured from different references are often independent. If they can be associated, it is best to leave only one note here, hope to be available in the future ).
A subquery (sub-query) is a SELECT statement in the WHERE- or HAVING-clause of another SELECT statement.Example subqueries:Subquery executes first and feeds output into the main query:SELECT ename, deptno  FROM emp WHERE deptno = (SELECT deptno                   FROM emp                  WHERE ename = 'TAYLOR');Correlated subquery (both executes simultaneously):SELECT ename, deptno, sal  FROM emp x  WHERE sal > (SELECT AVG(sal)        FROM emp        WHERE emp.deptno = x.deptno)  ORDER BY deptno;

 


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.