with as提高sql的执行效率
实战sql
with cte(UNIT_ID, UNIT_NAME, PARENT_UNIT_ID, UNIT_CODE ) as (
select UNIT_ID, UNIT_NAME, PARENT_UNIT_ID , UNIT_CODE
from HPFM_UNIT
union all
select t.UNIT_ID, t.UNIT_NAME, t.PARENT_UNIT_ID, t.UNIT_CODE
from HPFM_UNIT t
join cte on t.PARENT_UNIT_ID = cte.UNIT_ID
)
select * from cte
[DB][ORACLE]SQL中使用WITH AS提高性能和可读性_oracle with as 性能慢-CSDN博客
Oracle with as 用法-CSDN博客