Oracle SQL Hierarchical query bottom to top -


i have ids of leafs. need select id in hierarchy. i'm using following query:

select distinct id  table start id in (ids_of_leafs) connect id = prior pid 

but maybe can done way without distinct , traversal full hierarchy?

no, not possible without additional stuff adding custom index value every row , calculate mathematically things select. not native , heavy solution. cannot replace query if not know height of tree, , need manually write amount of select statements equals height of tree.

if have problems performance, create indices or materialized view collect parents every leave.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -