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: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 08 Dec 2005 14:35:45 -0800
Message-ID: <1134081346.609467@jetspin.drizzle.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.

  1. No error message.
  2. No DDL for the table
  3. No DDL for the constraint

Should we try to look over your shoulder or just guess what you are doing?

PS: You might want to look at the EMP table in scott or the EMPLOYEE table in HR.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Thu Dec 08 2005 - 16:35:45 CST

Original text of this message

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