Tree Like Result Set .
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Tree Like Result Set .

  1. #1
    Join Date
    Aug 2002
    Posts
    3
    Can any body tell me is there any support in Oracle
    For getting the result in nested way
    Something Like
    Select con.Name , (Select state.name from state where state.country = con.name ) from Country con

    And Returns the result in following Format

    USA
    [California
    Washington]

    India
    [DeLhi
    Maharashta
    Haryana ]
    ie result in TREE Format

    That is single Occurence of USA , India

    NOT LIKE
    USA California
    USA Washington

    India DeLhi
    India Maharashta
    India Haryana

    There is support for this thing Using Break But i Want if it is possible to take the resultSet in that way ( ie Java ResultSet)

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    you can user the connect by prior clause

    try this query on the emp table:
    select
    lpad(' ',2*(level-1))|| ename ,
    e.empno, e.mgr, e.job, e.deptno
    from emp e
    connect by prior empno = mgr
    start with mgr is null

    cheers,
    R.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width