Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Recursive Query
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.
TIA Received on Tue Sep 05 2006 - 18:18:43 CDT
![]() |
![]() |