1 Reply Latest reply: May 24, 2013 11:04 AM by Andreas Weiden RSS

    Hierarical Tree for building menus against user roles

    Qasim Javaid Malik
      Hi All,
      I am facing problem to build hierarical tree for building menus against users.
      I have table of menus with columns: ID, Menu_Name, Parent_ID etc.
      The query i have wrote is:
      SELECT -1, LEVEL, menu_name, NULL, parent_id
      FROM menus
      START WITH parent_id IS NULL
      CONNECT BY PRIOR id = parent_id;

      Now if I give access to a menu (level 3 or above), query should complete the hierarchy till the top. I wrote :
      SELECT -1, LEVEL, menu_name, NULL, parent_id
      FROM menu_opt
      START WITH parent_id IS NULL
      CONNECT BY PRIOR id = parent_id
      and id in (4, 5, 6);

      Note: where id 4, 5, 6 are at level 3 or above.
      How to complete the full path from top to bottom?
      Thanks
      Qasim Javaid Malik