Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can Oracle save a tree?
Generally yes, it is possible. Self-referencing (child_id, parent_id)
is the traditional way to do this. There is also several Oracle
functions to support these kind of data: SYS_CONNECT_BY_PATH, LEVEL
along with CONNECT BY in WHERE clause. See more examples in "SQL
Reference".
I created a datamodel (along maintenance procedures) for similar kind of requirements (tree structure with unknown numbers of types, conditions, level of depths etc.) and it working fine, it is fast enough also with hundreds of thousand rows, but I had to use some non-standard features - IOT (index organised tables), MV (materialised views), Analytic functions and lot of tunning to accomplish good performance.
ramon_at_conexus.net (Ramon F Herrera) wrote in message news:<c9bc36ff.0404271813.1f66aa34_at_posting.google.com>...
> The company I work for makes reports for other companies, based
> on geography, states, districts, etc. and the companies can vary
> from a one location shop, to a multinational with thousands of
> branch offices.
>
> Needless to say, the most natural way to store this is in
> a tree data structure. I have already done that at the Java-GUI
> front end, but I was wondering how to do it in the database.
>
> I realize that anything can be flattened to a relational table,
> but I understand that now Oracle has other non-traditional
> ways of storing data.
>
> So, is it possible to save a tree in Oracle?
>
> TIA,
>
> -Ramon F. Herrera
Received on Fri Apr 30 2004 - 04:06:04 CDT