Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> TreeView and Oracle Connect By
Working with Delphi 3 C/S and Personal Oracle 7
I have a small table in Oracle which is organized in 3 columns which models
different areas of law.
The columns are: Law_Id(number) which serves as the primary key,
Area(varchar2) and Parent_Id which is a foreign key referencing the primary
key of the same table.
The organization is for the purpose of displaying different areas of law in
a hierarchical way which i want to do in a TreeView. From each node of the
TreeView, I will be able to execute a stored procedure to fetch some data
from the database.
Area1
L Area1A
L Area1B-a L Area1C-a L Area1C-b L Area1D-a L Area1E-a L Area1F L Area1E-b L Area1E-c L Area1D-b L Area1C-c
Area2
L Area2A
L
etc.
Can anyone give me an example of how the Query shall be put together for the
easiest way to build the TreeView and at the same time an example of the
TreeView construct to get me in the direction, as i am not familiar with
these constructs.
I understand there is some special construct in Oracle just for the purpose
of such a hierachical representation called connect by.
SELECT *
FROM Law
CONNECT BY Parent_ID = PRIOR Law_Id
Anyhow i cannot figure out how to do the job.
Thanks in advance
Magnus Received on Sun Apr 25 1999 - 12:42:07 CDT