Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Binary Tree Implementation

Re: Binary Tree Implementation

From: <jkstill_at_gmail.com>
Date: 9 Dec 2005 10:22:55 -0800
Message-ID: <1134152575.858024.89560@g44g2000cwa.googlegroups.com>

No Such Luck wrote:
> I'm new to Oracle (10G), and I'm trying to create a binary tree
> structure with a self-referencing table, but I am having some trouble.
>
> Table NODE
> NODEID (PK)
> PARENTNODEID (FK)
> LEFTCHILDNODEID (FK)
> RIGHTCHILDNODEID (FK)
> DATA
>
> The FK constrained fields have two purposes:
> - They can be initially NULL, but when a node ID is later entered, it
> must be a valid NODEID for an existing entry.
> - Cascade deletes: If a parent node is deleted, all children (and
> their children) must be deleted as well.
>
> When I try to apply an FK constraint on any of the parent or child id
> columns, I receive a deadlock time out.
>
> Can any point me in the direction of my error, or perhaps suggest a
> better or different way of doing this?
>
> Thanks in advance.

If you are an IOUG member, take a look at Underneath the Mango Tree: Picking Up the Tree Fruit with CONNECT BY By Stéphane Faroult

This article shows how to create trees in Oracle. (9i I think)

Or try the google cached version:
http://66.102.7.104/search?q=cache:JSAjaph7_fsJ:www.selectonline.org/viewFile.cfm%3FreturnPage%3Dhttp://www.ioug.org/client_files/members/select_pdf/04q1/CNCTBY.pdf+%22stephane+faroult%22+tree+fruit&hl=en Received on Fri Dec 09 2005 - 12:22:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US