Professional Documents
Culture Documents
25678ui Hierarchical Queries Recap PDF
25678ui Hierarchical Queries Recap PDF
A hierarchy is built upon a parent-child relationship within the same table or view. If a table
contains hierarchical data, then you can select rows in a hierarchical order using the
hierarchical query clause.
Below are the points to keep in mind when building a hierarchical query.
• There are two mandatory keywords to build a hierarchy, CONNECT BY and PRIOR.
• CONNECT BY specifies the relationship between parent rows and child rows of the
hierarchy.
Number generation
SELECT LEVEL AS C_NUMBER
FROM DUAL
CONNECT BY LEVEL <= 1000;