Re: Limit the levels for a query with CONNECT BY

From: Daniel Roy <danielroy10junk_at_hotmail.com>
Date: 5 Nov 2003 13:42:58 -0800
Message-ID: <3722db.0311051342.1633026d_at_posting.google.com>


If you don't know beforehand the LEVEL value, I'm afraid you will need first to run a query to find this value. As for your concern that Oracle will need to process the whole tree just to display N levels, you're probably right. Run the explain plan, and we'll be able to see for sure.

Daniel

>
> I have two concerns with LEVEL:
>
> First,
>
> I do not know in advance at what level the specific row is ! The table
> contains the structure and content of complex SGML documents; the SGML
> structure (DTD) can be different from one document to the other and
> can even change over time
>
> (for example, I can have a document with
> PUBLICATION - CHAPTER - SECTION - TASK
> structure today, but in future, the person in charge of the
> publication can decide to add a layer, as in
> PUBLICATION - CHAPTER - SECTION - PAGEBLOCK - TASK,
> so the level to find the TASK is now changed and the query will not
> find it anymore).
>
> Second,
>
> Even if I ask to display only the, for example, 3 first LEVELs, am I
> right when I say the query will process the complete tree structure
> anyway before returning me only the rows I'm interested in ?
>
>
>
> Bernard Drolet
Received on Wed Nov 05 2003 - 22:42:58 CET

Original text of this message