Tree query issue
591953Oct 24 2008 — edited Oct 24 2008Good morning,
Obviously, I simply do not understand the query that gets constructed to create a Tree structure in APEX. I have a Tree in Oracle Forms that works correctly. I cannot, however, seem to get it to port over to APEX.
In my table (a table of contents type of structure), I have 3 columns that govern where in the list an item falls. TOC_LEVEL (1 a parent-level entry, or 2 child-level entry), TOC_PARENT, what parent a child entry is associated with, and TOC_SEQ_ID, where in the list an item should be placed.
So, I might have entries like this:
TOC_LEVEL TOC_PARENT TOC_SEQ_ID
1 NULL 1
2 1 50
2 1 60
1 2 2
1 3 3
2 3 50 - dups here don't matter because it would fall under a different parent...
2 3 75
and so-on.
The query that I use in my Form is this:
select decode(level,-1,-1,-1),
level,
toc_description,
toc_entry_type,
toc_id
from toc where state_id = '&State_ID'
start with toc_level = 1
connect by prior toc_seq_id = TOC_Parent
and prior State_ID = '&State_ID'
order by to_char(toc_parent) || to_char(toc_seq_id)
and this works. I am able to display and retrieve the appropriate data.
I can NOT seem to get this or any variation to work within APEX.
The closest I have come is that I retrieve all of the parent-level entries, but retrieve the very same child-entries under each parent. And when I click the '+' on one parent, ALL parents expand... and the '-' colapses all parents, not just the one I clicked.
What is it that I am missing here?
Thanks,
Don