Representing a tree structure in Oracle

Hi all Oracle users,
I have the need to represent a hierarchical structure (taken from an .xsd file) into an Oracle database.
Can anybody give me some directions what is the best approach for storing a tree structure into an Oracle database ?
Thanks a lot
Francesco

Hello,
thanks for your kind replies.
Well, the kind of structure I want to flatten in a database, consists of a set of elements, each of whom, contains an undetermined set types:
<element name="vsDataPlmn" substitutionGroup="xn:vsData">
          <complexType>
               <complexContent>
                    <extension base="xn:vsData">
                         <sequence>
                              <element name="userLabel" minOccurs="0"/>
                              <element name="mnc" minOccurs="0"/>
                              <element name="mncLength" minOccurs="0"/>
                                   <complexType>
                                        <sequence>
                                             <element name="mcc" minOccurs="0"/>
                                             <element name="mnc" minOccurs="0"/>
                                             <element name="mncLength" minOccurs="0"/>
                                        </sequence>
                                   </complexType>
                              </element>
                         </sequence>
                    </extension>
               </complexContent>
          </complexType>
     </element>
In a previous work of mine, I represented a tree structure with a simple rule: for each element I had:
Rowid, RowDescription ......., ParentRowId
This might work, however I wonder if there is any Oracle DB structure which is optimized to represent a hierarchy of elements ?
Hope I was clear,
thanks
Franc.

Similar Messages

  • How to create a tree structure using forms.

    Hi,
    How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
    thanks in advance
    Regards
    Karthik

    The FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
    " in the online help this point to all the functions and triggers

  • Tree structure visualisation methods

    I am still working with the BTree .
    I would like some help on how to represent the tree structure on the screen .
    I have used the Breadth_first method and saved all the data into an Array , But I am lost on how to represent the tree on the screen.
    Thanks
    B747

    Define your own javax.swing.tree.TreeModel with your B-Tree (is it a b-tree or a binary tree?) as the data source. Then you can show the tree in a swing frame using JTree.
    Talden

  • Oracle OID Tree Structure resolution to find SID

    Hi Team,
               With out DNS SRV record Can OID ldap tree Automatically resolve its primary domain. Ex: if i have sub directory structure under example.com "abc & xyz two separate Directories", I want to resolve SID.abc or even SID should be going through the tree structure and resolves FIFO method!. Right now it works with SID.ABC.EXAMPLE.COM, but i do not want to give example.com every time. Is there a better solution with in OID?
    Currently we are using OID to resolve SID Names only, so it is not integrated with OIDM Suite.

    Hi,
    I guess this might be issue with Database, because it happens to only some users and that too occasionally. If the user closes the browser and opens next time he/she won't get the problem .
    Weiden: The Child/leaf nodes are not displayed in some cases while the root/parent is displayed correctly.
    CraigB: Forms version- 11.1.4, jre version-1.6.0_22-b04
    Thanks,
    Dass
    Edited by: user13364758 on Jul 5, 2012 5:41 AM

  • How to create a form on a tree structured table

    Hi,
    I have a table that is designed to do a tree structure  like:
    Table Name: test
    Fields:
    ID
    ParentID
    Description
    I created a browser (IR) (page 1) that calls a form (page 2)
    The form has the editing fields and at the bottom layer I have a reports region where I display the children records using a query like:
    select * from test where ParentID = :P2_ID
    I need at the region level to add a button to call a form to edit the child record (which is the same table) and when done, to return to the form again but to the parent record.
    How can I do that successfully? Is there any example:?
    Thank you

    Maybe this can help:
    http://apex.oracle.com/pls/otn/f?p=31517:157
    using instead of trigger on a view.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Listing File Hierarchy in console using a Tree structure

    first off i'm a college student. i'm not that good at java... we got this CA in class and try as i might i just can't get my head around it
    i was wondering if someone who know a bit more about java then i do would point me in the right direction, were i'm going wrong in my code
    i have to list out sub-files and sub-directorys of a folder (i.e. C:/test) to console using tree structure
    like this
    startingdir
    dir1 //subfolder of startingdir
    dir11 //subfolder of dir1
    dir111 //subfolder of dir11
    dir12 //subfolder of dir1
    file1A // document on dir1
    dir2 //subfolder of startingdir
    Tree.java
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.ListIterator;
    import java.util.NoSuchElementException;
    import java.util.Deque;
    public class Tree<E> {
        // Each Tree object is an unordered tree whose
        // elements are arbitrary objects of type E.
        // This tree is represented by a reference to its root node (root), which
        // is null if the tree is empty. Each tree node contains a link to its
        // parent and a LinkedList of child nodes
        private Node root;
        //////////// Constructor ////////////
        public Tree () {
        // Construct a tree, initially empty.
            root = null;
        //////////// Accessors ////////////
        public boolean isEmpty () {
        // Return true is and only if this tree is empty.
             return (root == null);
        public Node root () {
        // Return the root node of this tree, or null if this tree is empty.
            return root;
        public Node parent (Node node) {
        // Return the parent of node in this tree, or null if node is the root node.
            return node.parent;
        public void makeRoot (E elem) {
        // Make this tree consist of just a root node containing element elem.
            root = new Node(elem);
        public Node addChild (Node node, E elem) {
        // Add a new node containing element elem as a child of node in this
        // tree. The new node has no children of its own. Return the node
        // just added.
            Node newChild = new Node(elem);
            newChild.parent = node;
            node.children.addLast(newChild);
            return newChild;
        public E element (Node node) {
             return node.getElement();
        //////////// Iterators ////////////
        public Iterator childrenIterator (Node node) {
            return node.children.iterator();
        public Iterator nodesPreOrder () {
        // Return an iterator that visits all nodes of this tree, with a pre-order
        // traversal.
            return new Tree.PreOrderIterator();
        //////////// Inner classes ////////////
        public class Node {
            // Each Tree.Node object is a  node of an
            // unordered tree, and contains a single element.
            // This tree node consists of an element (element),
            // a link to its parent
            // and a LinkedList of its children
            private E element;
            private Node parent;
            private LinkedList<Node> children;
            private Node (E elem) {
                // Construct a tree node, containing element elem, that has no
                // children and no parent.
                this.element = elem;
                this.parent = null;
                children = new LinkedList<Node>();
            public E getElement () {
            // Return the element contained in this node.
                return this.element;
            public String toString () {
            // Convert this tree node and all its children to a string.
                String children = "";
                // write code here to add all children
                return element.toString() + children;
            public void setElement (E elem) {
            // Change the element contained in this node to be elem.
                this.element = elem;
        public class PreOrderIterator implements Iterator {
            private Deque<Node> track; //Java recommends using Deque rather
            // than Stack. This is used to store sequence of nomempty subtrees still
            //to be visited
            private PreOrderIterator () {
                track = new LinkedList();
                if (root != null)
                    track.addFirst(root);
            public boolean hasNext () {
                return (! track.isEmpty());
            public E next () {
                Node place = track.removeFirst();
                //stack the children in reverse order
                if (!place.children.isEmpty()) {
                    int size = place.children.size(); //number of children
                    ListIterator<Node> lIter =
                            place.children.listIterator(size); //start iterator at last child
                    while (lIter.hasPrevious()) {
                        Node element = lIter.previous();
                        track.addFirst(element);
                return place.element;
            public void remove () {
                throw new UnsupportedOperationException();
        FileHierarchy.java
    import java.io.File;
    import java.util.Iterator;
    public class FileHierarchy {
        // Each FileHierarchy object describes a hierarchical collection of
        // documents and folders, in which a folder may contain any number of
        // documents and other folders. Within a given folder, all documents and
        // folders have different names.
        // This file hierarchy is represented by a tree, fileTree, whose elements
        // are Descriptor objects.
        private Tree fileTree;
        //////////// Constructor ////////////
        public FileHierarchy (String startingDir, int level) {
            // Construct a file hierarchy with level levels, starting at
            // startingDir
            // Can initially ignore level and construct as many levels as exist
            fileTree = new Tree();
            Descriptor descr = new Descriptor(startingDir, true);
            fileTree.makeRoot(descr);
            int currentLevel = 0;
            int maxLevel = level;
            addSubDirs(fileTree.root(), currentLevel, maxLevel);
        //////////// File hierarchy operations ////////////
        private void addSubDirs(Tree.Node currentNode, int currentLevel,
                int maxLevel) {
        // get name of directory in currentNode
        // then find its subdirectories (can add files later)
        // for each subdirectory:
        //    add it to children of currentNode - call addChild method of Tree
        //    call this method recursively on each child node representing a subdir
        // can initially ignore currentLevel and maxLevel   
            Descriptor descr = (Descriptor) currentNode.getElement();
            File f = new File(descr.name);
            File[] list = f.listFiles();
            for (int i = 0; i < list.length; ++i) {
                if (list.isDirectory()) {
    File[] listx = null;
    fileTree.addChild(currentNode, i);
    if (list[i].list().length != 0) {
    listx = list[1].listFiles();
    addSubDirs(currentNode,i,1);
    } else if (list[i].isFile()) {
    fileTree.addChild(currentNode, i);
    // The following code is sample code to illustrate how File class is
    // used to get a list of subdirectories from a starting directory
    // list now contains subdirs and files
    // contained in dir descr.name
    ////////// Inner class for document/folder descriptors. //////////
    private static class Descriptor {
    // Each Descriptor object describes a document or folder.
    private String name;
    private boolean isFolder;
    private Descriptor (String name, boolean isFolder) {
    this.name = name;
    this.isFolder = isFolder;
    FileHierarchyTest.javapublic class FileHierarchyTest {
    private static Tree fileTree;
    public static void main(String[] args) {
    FileHierarchy test = new FileHierarchy ("//test", 1);
    System.out.println(test.toString());

    Denis,
    Do you have [red hair|http://www.dennisthemenace.com/]? ;-)
    My advise with the tree structure is pretty short and sweet... make each node remember
    1. it's parent
    2. it's children
    That's how the file system (inode) actually works.
    <quote>
    The exact reasoning for designating these as "i" nodes is unsure. When asked, Unix pioneer Dennis Ritchie replied:[citation needed]
    In truth, I don't know either. It was just a term that we started to use. "Index" is my best guess, because of the
    slightly unusual file system structure that stored the access information of files as a flat array on the disk, with all
    the hierarchical directory information living aside from this. Thus the i-number is an index in this array, the
    i-node is the selected element of the array. (The "i-" notation was used in the 1st edition manual; its hyphen
    became gradually dropped).</quote>

  • JPA  -  tree structure mapping    with toplink essential

    I'll try to explain it correctly.
    I store a tree structure in a database. I have just two tables:
    Node which contain a id , and some other info.
    Tree which contain a parent and child
    parent and child are ids from node.
    Since each node can have several childs, and each node can have several parents, I had try a @ManyToMany relationship without sucess.
    Here one small example of my tries :
    @Entity
    @Table(name="node")
    public class Node {
    @Id private int id;
    private List<Node> childs;
    private List<Node> parents;
    @ManyToMany
    @JoinTable(name="Tree")
    public List<Node> getParents(){
         return parents;
    @ManyToMany(mappedBy="parents")
    public List<Node> getChilds(){
         return childs;
    }But I always got several error.
    Anyone have a working example that look like mine ?
    Even after googling for several hours I still find nothing.
    If it helps, I use toplink essential for my persistance layer.

    Please see http://www.oracle.com/technetwork/middleware/toplink/index-085257.html for information on TopLink JPA support.
    So as of TopLink 11, you will need to use EclipseLink's org.eclipse.persistence.jpa.PersistenceProvider as the provider class for JPA support, which is in the eclipselink.jar.
    Best Regards,
    Chris

  • How to create a tree structure using list items(tlist)

    HI every one,
    As we know how to create a tree structure using Hierarchy item type.
    We have a requirement to create The same tree like structure using List Item(Tlist)
    I would be so appreciated If you send with an example
    Thanks
    RangaReddy

    Hi all
    Any one help me please
    Actually our client requirement is creation of tree structure using list item,similar to what we used in oracle Application(FNDSCSGN) form.We did the tree structure using hierarchy tree using Htree and Ftree.It working excelently.For client requirement, we want to use list item.How PJC(Pluggable Java Components) is useful for using list item(Tlist).I can't understand how it is useful.
    Do you have any example please help me.
    Thanks
    RangaReddy

  • Display E-Business Suite Navigation in Tree Structure

    Hello:
    When I login to E-Business Suite the Module display is in Folder format
    Is it possible to display Tree Structure?
    When can I get the instruction?
    Please help
    Vijay

    Hi,
    Is there a way where I can create a VO in ADF to which I can insert records dynamically from a source and the Source connects to E Business Suite tables and returns results ie BPEL etc.
    http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0341
    Just replace the PLSQL example with your data source
    Can ADF invoke SOA which inturn connects to Oracle E Business Suite and fetches the data from Oracle tables and pass it back to ADF? Is it possible
    Yes. Just use a WS proxy client to access the SOA entry point (WSDL) and follow the link above
    Frank

  • Make tree structure persitent

    Hello,
    i have a tree structure in my Webdynpro.
    For example a project of buildings, levels, floors and rooms.
    This works fine with recursive nodes in the context and the WD-Tree-UI-Element.
    Now i want to make this persistent in my Database.
    I use CAF with Application Services, WebService and Business Objects.
    What is the best BO-Structure ? One BO with an association to himself ?
    I test it, but i doesn't work.
    Or better a BO with a parentKey-Field and no assocation ?.
    What is the best way ?
    What ist the best container to transfer the tree-date to the Application-Service to store and load it.
    Can anybody help me ?.
    Thanks.
    Best regards
    Klemens

    Hi, please read the FAQ before posting again.  Following those guidelines will yield better results and sooner.
    See this link for some great examples of APEX Trees:
    http://apex.oracle.com/pls/apex/f?p=36648
    Jeff

  • Creating a tree structure like Windows file explorer using Jdev

    Hi All,
    Is it possible to develop a tree structure like windows in JDEV and then same page I want to move to oracle apps.
    This tree I am creating for Showing Employee information. Like Parents & childs under it. i.e. Managers and employee reporting to managers.
    Please let me know if it is possible, if yes how , what is method of doing this.
    Thanks
    Ganesh Mane

    Yes. This possible with ADF Faces RC, which provides an af:tree component. Have a look at the Fusion Order Demo, which uses the tree to implement a similar usecase to the one you describe.
    http://www.oracle.com/technology/products/jdev/samples/fod/index.html
    Regards,
    RiC

  • Can we change the Bill/Payment tree structure on Control central page?

    Can we change the Bill/Payment tree structure on Control central page to Bill/Payment Tree containing a single node for all A/R related activities for a specific bill period, in reverse chronological order. Basically the tree should look like
    + Bill - Date: 03-17-2010 Complete
    +++++ CR Note - Date: 05-04-2010 Complete
    ++++++++++ Pay - Date: 05-04-2010 Frozen
    + Bill - Date: 03-17-2010 Complete
    +++++ Pay - Date: 05-04-2010 Frozen
    I have tried changing controlCentralBPTree.xml but if I do that the tree is not expanding its just collapsed I m not able to expand.
    So do I need to change some other file to change the tree structure and look like above?

    Hello CHS.
    I tested your project but to change the label and has not worked.
    I tried running the Application Module and test the ViewCriteria, and show correctly the labels defined in control hint of bind variable.
    Again, I think the component af:query should do the same, but does not work.
    Any Oracle ACE Director some could verify this problem?
    thank you very much

  • Forum ?Unusual tree Structure

    hi admins,
    today i noticed something unusual in forum tree structure,
    https://forums.oracle.com/forums/main.jspa?categoryID=84
    Especially Business Intelligence,Private,Enterprise Management,Server & Storage Systems,Java,Fusion Middleware tree.
    if expanded or collapsed nothing different . is this like so?
    thank&&regards
    adf7.

    ADF7 wrote:
    did anyone noticed?Of course many of us have noticed.
    The site administrators are constantly rearranging things so that the forums reflect the reality of Oracle's product line.
    This is not a new event, but is an on-going process.
    As products appear and as products retire, the forum layout will change.

  • Tree Structure generation in content management

    Hi,
    I am new to Oracle portals.I have a task of generating a default
    tree structure based on say somes values from database eg: DEALS1,DEALS2, DEALS3 displayed, when I create or click any of these it should open a dynamic folder structure depending on users security level.One of the examples oracle uses is when you create a content area, by default portal generates Folders
    folder , Category folder, Navigation bar folders , etc.
    2. Is it possible to achieve tree similar to the one Oracle Portal displays when we open a default content page and click Content Area Map on top left , i.e with folders expands and closes on each click to Icon.
    Thanks
    Morozov

    Is it feasible in your scenario to simply set the unwanted folders to "hidden" or is it completely ACL-based? With the regular end-user explorers (e.g. ConsumerExplorer), hidden folders won't be shown (this is a setting of the corresponding collection renderer). Administrative Explorers (e.g. Admin Explorer) do show hidden files, though. Note that you can only modify the hidden state with such an administrative explorer. This makes sure that you have at least one way to reset that state and to not hide it in an explorer that afterwards does not show the file and thus would not allow you to reverse that step (in principle this means that users with no administrative accesses whatsoever will never be able to hide resources).
    Regards, /-/ans-Juergen

  • Displaying Tree Structure

    Hi every one,
    I have the following data in oracle DB
    NUMBER() VARCHAR2(30) CHAR(1),NULL NUMBER()
    WEB_GROUP_ID WEB_GROUP_DESC FLAG PARENT_WEB_GROUP_ID
    101 xxx
    102 yyy 101
    103 zzz 101
    104 xyz
    105 abc 104
    106 pqr 102
    107 aaa 102
    108 rrr 106
    109 xxxxcxx 106
    and i want to display the following structure in my jsp page like a tree
    101
    |
    |
    +----102
    | |
    |     |
    |     +---106
    |     |     |
    |     |     +--108
    |     |     +--109
    |     |
    |     +---107
    |
    +----103
    104
    |
    |
    +----105
    like this i have to print in the jsp page as a tree structure/File Explorer
    Can any one send me the code for this one..
    Thanks & Regards
    SAN

    Hi,
    Don't hold your breath while you are waiting. :)
    This is a forum where you can ask specific questions that are related to programming, and people might post short code examples, but don't expect people to post complete code.
    What have you done so far? How did it fail?
    Kaj

Maybe you are looking for