티베로(Tibero) 오라클(Oracle)

오라클 트리구조 정렬

xemaker 2019. 1. 25. 11:05
오라클 트리구조에서 정렬을 하려고 했다.

select level -1 as depth
,code_name
,code_cd
,code_seq
,high_rank
from table
start with high_rank='A'
connect by prior code_cd=high_cd
order by code_seq
;

저런식으로 order by code_seq
로 했더니

뜨악!

정렬이 안되는것이였다.

알고봤더니 트리구조에서는 정렬을

order siblings by code_seq

이런식으로 siblings 를 써야 했다.