Home » SQL & PL/SQL » SQL & PL/SQL » to find parent levels from all the levels existing
to find parent levels from all the levels existing [message #7411] Thu, 12 June 2003 02:41 Go to next message
priya
Messages: 108
Registered: February 2000
Senior Member
Hi all,
I have a requirement where i need to find the parent levels for the given levels

------------------------------HO-----------------------------
|
----------------RO1----------------- ---------------RO2---------------
| | |
------CO1------ -------CO2------ -----CO3------ -----CO4-----
| | | | | | |
ZO1 ZO2 ZO3 ZO4 ZO5 ZO6 ZO7 ZO8

my table structure is
create table hierarchy_levels
(
hl_level_id number(10) constraint pk_hl_level_id primary key,
hl_level_code varchar2(35) constraint nn_hl_level_code not null,
hl_level_name varchar2(2000),
hl_parent_level_id number(10), --fk_hl_parent_level_id
hl_entry_by varchar2(8) constraint nn_hl_entry_by not null,
hl_entry_dt date constraint nn_hl_entry_dt not null,
hl_upd_by varchar2(8),
hl_upd_dt date,
hl_last_mod_dt date,
constraint fk_hl_parent_level_id foreign key hl_parent_level_id
references hierarchy_levels(hl_level_id)
)

i need to find the parent levels i am attaching data also
HL_LEVEL_ID
HL_LEVEL_CODE
HL_LEVEL_NAME
HL_PARENT_LEVEL_ID
HL_ENTRY_BY
HL_ENTRY_DT
HL_UPD_BY
HL_UPD_DT
HL_LAST_MOD_DT

36
Corp1
Corporate Office
36
admin
10-Jun-2003 14:50:53
admin
10-Jun-2003 20:16:08
10-Jun-2003 20:16:08

40
Reg
Regional Office
36
admin
10-Jun-2003 15:21:42
admin
10-Jun-2003 15:21:42
10-Jun-2003 15:21:42

41
County
Country Office
40
admin
10-Jun-2003 15:23:40
admin
10-Jun-2003 15:23:40
10-Jun-2003 15:23:40

42
zone
Zone Office
41
admin
10-Jun-2003 18:26:30
admin
10-Jun-2003 18:26:30
10-Jun-2003 18:26:30

43
zone1
Zone1 Office
41
admin
10-Jun-2003 18:26:41
admin
10-Jun-2003 20:20:03
10-Jun-2003 20:20:03

44
Reg2
Regional2 Office
36
admin
12-Jun-2003 11:46:17
admin
12-Jun-2003 11:46:17
12-Jun-2003 11:46:17

45
Zonal3
Zonal Office
44
admin
12-Jun-2003 11:48:25
admin
12-Jun-2003 11:48:25
12-Jun-2003 11:48:25
Re: to find parent levels from all the levels existing [message #7412 is a reply to message #7411] Thu, 12 June 2003 02:56 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Look at Hierarchical Queries or at this example.

MHE
Previous Topic: Create Table Question
Next Topic: connect by prior, to find parent levels from all levels
Goto Forum:
  


Current Time: Wed Apr 24 09:52:11 CDT 2024