with as 级联查询

with t(id,
parent_classify_id,
classify_name,
full_path) as
 (select a.id,
         a.parent_classify_id,
         a.classify_name,
         classify_name full_path
    from dm_classify a
   where a.id = '13138'
  union all
  select b.id,
         b.parent_classify_id,
         b.classify_name,
         c.full_path || '/' || b.classify_name
    from dm_classify b, t c
   where b.parent_classify_id = c.id)
select * from t;

你可能感兴趣的:(oracle)