I need to develop a tree view for a table ,the connection being provided by two columns 'sample' and 'sample_source'.
I use a hierarchical sql query for that .
The sample code is given below:
select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
level,
sample as title,
'icon-tree-folder' as icon,
sample as value,
sample as tooltip,
null as link
from (select sample,sample_source from table_name group by (sample,sample_source))
start with sample is null
connect by prior sample=sample_source
order siblings by sample
Here my problem is that. In the first level, both sample and sample_source are null. In the next level,sample is not null, sample_source will be null . Remaining all levels sample and sample_source are not null.
So using the above query I am not able to make the connection from first to second level (may be because of null values) so that the tree wont be displayed..