Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Recursive Query
google_at_easiesttoremember.com wrote:
> Can anyone show an example of a simple recursive query? Say I've got
> an overly simplified table like this:
>
> CREATE TABLE Folders (
> ID varchar2 (36) NOT NULL ,
> ParentFolderID varchar2 (36) ,
> Name varchar2 (255) NOT NULL
> );
>
> Any folder record can have any other folder as its parent (within the
> limits of a hierarchy).
>
> I'd like to give the query an ID and an IsItUnderThisID value and the
> query would walk up the hierarchy through the ParentFolderID looking
> for IsItUnderThisID or NULL (NULL indicating it's at the top of the
> hierarchy). I don't care what it returns, just as long as what it
> returns is different between finding that the ID is indeed under the
> IsItUnderThisID or that the root was hit without finding it... or heck!
> ANY example of a recursive query... even one that has nothing to do
> with this example... I just need an example... I can adapt it to my
> needs if shown a working example.
>
> I've searched and search and can't find an example of recursive
> queries, though I've seen plenty of posts talking about them.
Have you tried searching for "recursive query" (with the quotes) on asktom.oracle.com?
Also see Hierarchical Queries in the SQL Reference Guide. http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm#i2053935
jg
-- @home.com is bogus. 1000 years of video per day. http://www.businessweek.com/magazine/content/06_37/b4000401.htm?chan=tc&campaign_id=bier_tcst0Received on Tue Sep 05 2006 - 18:53:24 CDT
![]() |
![]() |