Call for Oracle support & training (800) 766-1884
Free Oracle Tips

Home
Corporate Oracle Training
Custom Oracle Training
Oracle New Features Training
Advanced Oracle DBA Classes
Oracle Tuning Courses
Oracle Tips & Tricks
Oracle Training Links
Oracle Training Links
Oracle Training Links

We are top for USA Oracle Training Clients

 

Free Oracle Tips


 
HTML Text AOL

Free Oracle App Server Tips


 
HTML Text

Oracle support

Oracle training

Oracle tuning

Rednecks!

Remote Oracle

Custom Oracle Training

Future enhancement to the WITH clause

UPDATE:  This has now been implemented in 11g Release 2.  For more information see Recursive subquery factoring using the SQL WITH clause

 

Even though it is part of the ANSI SQL standard, as of Oracle 10g, it should be noted that the WITH clause is not yet fully functional within Oracle SQL, and it does not yet support the use of WITH clause replacement for CONNECT BY when performing recursive queries.

 

To show how the WITH clause is used in ANSI SQL-99 syntax, the following is an excerpt from Jonathan Gennick’s work Understanding the WITH Clause showing the use of the SQL-99 WITH clause to traverse a recursive bill of materials hierarchy. 

 

NOTE: This ANSI SQL syntax does NOT work (yet) with Oracle SQL

 

WITH recursiveBOM

   (assembly_id, assembly_name, parent_assembly) AS

(SELECT parent.assembly_id,

        parent.assembly_name,

        parent.parent_assembly

FROM bill_of_materials parent

WHERE parent.assembly_id=100

UNION ALL

SELECT child.assembly_id,

       child.assembly_name,

       child.parent_assembly

FROM recursiveBOM parent, bill_of_materials child

WHERE child.parent_assembly = parent.assembly_id)

SELECT assembly_id, parent_assembly, assembly_name

FROM recursiveBOM;

 

The WITH clause allows one to pre-materialize components of a complex query, making the entire query run faster.  This same technique can also be used with Global temporary tables.


 

SEE CODE DEPOT FOR FULL SCRIPTS


This is an excerpt from my latest book "Oracle Tuning: The Definitive Reference". 

You can buy it direct from the publisher for 50%-off and get instant access to the code depot of Oracle tuning scripts:

http://www.rampant-books.com/book_1002_oracle_tuning_definitive_reference_2nd_ed.htm

 

 

 
 
 

Oracle performance tuning book

 

 

Oracle performance tuning software

 
Oracle performance tuning software
 
Oracle performance Tuning 10g reference poster
 
Oracle training in Linux commands
 
Oracle training Excel
 
 
 
 
 
email BC:


Copyright © 1996 -  2014 by Burleson Inc. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.