What is an recursive sub-query factoring?

1. Overview

This document talks about an example of a recursive subquery factoring clause.

2. Technologies and Tools Used

The following technologies have been used to achieve exporting IR data to Word format.

  • Oracle SQL

3. Use Case

An alternative method of performing hierarchical queries from CONNECT BY clause is the recursive subquery factoring clause. A recursive subquery factoring clause must contain two query blocks combined by a UNION ALL set operator. The first block is known as the anchor member, which can not reference the query name. It can be made up of one or more query blocks combined by the UNION ALL, UNION, INTERSECT or MINUS set operators. The second query block is known as the recursive member, which must reference the query name once.

4. Architecture 

Here are some examples of using recursive subquery factoring to understand its working easily:

SQL:       

with t(a) as

(

    select 1 as a from dual

    union all

    select a+1 from t where a< 10

)

select a from t;

O/P:

A
1
2
3
4
5
6
7
8
9
10
Recent Posts