Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Oracle "connect by" syntax

Oracle Tips by Burleson Consulting

 


 

Hierarchical Query Pseudo-columns

The new hierarchical query pseudo-columns are valid only in hierarchical queries. The specific hierarchical query pseudo-columns are:

  •  connect_by_iscycle
     

  • connect_by_isleaf

Additions to the CONNECT BY clause enhance queries of hierarchical data by returning all ancestor-dependent pairs (not just parent-child pairs); a new set of pseudo-columns is provided in Oracle Database 10g:

  • connect_by_iscycle
     

  •  connect_by_isleaf
     

  •  connect_by_root

These specify whether or not a given node is a leaf of a hierarchy, a cycle in a hierarchy triggers an error message with information about the rows involved in the cycle, and the CONNECT BY clause is now supported for simple subqueries.

By adding the nocycle parameter in the CONNECT BY condition, we can cause Oracle to return the rows despite the loop. The connect_by_iscycle pseudo-column will show you which rows contain the cycle:

SQL> SELECT ename "Employee", CONNECT_BY_ISCYCLE "Cycle",
   2 LEVEL, SYS_CONNECT_BY_PATH(ename, ’/’) "Path"
   3 FROM scott.emp
   4 SEE CODE DEPOT FOR FULL SCRIPT
   5 START WITH ename = ’KING’
   6 CONNECT BY NOCYCLE PRIOR empno = mgr AND LEVEL <= 4;

Employee       CYCLE      LEVEL Path
-------------- -----  --------- ------------------
KING               0          1 /KING
CLARK              1          2 /KING/CLARK
MILLER             0          3 /KING/CLARK/MILLER


The above text is an excerpt from:

Oracle SQL Tuning & CBO Internal
ISBN 0-9745993-3-6

by Kimberly Floss
 

Related CONNECT BY Articles:


 

 

  
 
  
 
 
 

 
 
 

Oracle training Excel
 
Oracle performance tuning software 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2014

All rights reserved by Burleson

Oracle © is the registered trademark of Oracle Corporation.