select lpad(' ',2*(level-1))||operation||' '||options||' '
||object_name||' '
||decode(partition_start,'','','partitions:'||partition_start||'-'||partition_stop||' ')
||decode(object_node,'','','['||object_node||'] ')
||decode(optimizer,'','','['||optimizer||'] ')
||decode(id,0,'Cost = '||position) query
from plan_table
start with id=0
and timestamp = (select max(timestamp)
                 from  plan_table
                 where id=0
                 and   nvl(statement_id, ' ') not like 'SYS_LE%')
and nvl(statement_id, ' ') not like 'SYS_LE%'
connect by (prior id = parent_id
and prior nvl(statement_id, ' ') = nvl(statement_id, ' ')
and prior timestamp <= timestamp)
/
