Hierarchical quera

From: El - Fatih <zivjeli_at_veselili.se>
Date: Wed, 29 May 2002 11:15:31 +0200
Message-ID: <ad269g$f4o6_at_ns4.bih.net.ba>


Hi

I have a problem with displaying the organisational structure from table org_units which have the following structure:

Name                            Null?    Type
------------------------------- -------- ----
ORG_TYPE                  NOT NULL VARCHAR2(1)
ID                                    NOT NULL NUMBER(38)
NAME                            NOT NULL VARCHAR2(100)
OUT_ORG_TYPE                            VARCHAR2(1)
OUT_ID                                              NUMBER(38)

Primary key of this table is OUT_PK and it is composed of two columns: ORG_TYPE and ID.
This table has foreign key to itself composed of following two columns OUT_ORG_TYPE and OUT_ID.
Columns OUT_ORG_TYPE and OUT_ID points to superior organisational units. Can you help me, please, to make appropriate query. This query does not work.

select lpad(' ',3*level-3)||name from org_units connect by prior org_type=out_org_type and id=out_id start with out_org_typeis null and out_id is null

Thanx Received on Wed May 29 2002 - 11:15:31 CEST

Original text of this message