给MMT 产品类别(大)建立新的功能视图

create or replace view v_base_pd_type_tree as

select t."PD_TYPE",t."PAR_PD_TYPE",t."PD_NAME",t."PD_TYPE_SIGN",

       LPAD('|-', (level - 1) * 4, ' | ') || LPAD('『', 2) || t.pd_name ||

       RPAD('』', 2) pd_name_tree

  from (select a1.pd_type,

               case

                 when a2.pd_type = a1.pd_type then

                  0

                 else

                  a2.pd_type

               end as par_pd_type,

               a1.pd_name,

               a1.pd_type_sign

          from base_pd_type a1, base_pd_type a2

         where a1.pd_type_sign = a2.pd_type_sign

           and a2.is_model = 1

           and a1.del_mark = 0) t

 start with t.par_pd_type = 0

connect by prior t.pd_type = t.par_pd_type;

posted @ 2011-03-16 13:25  笑的自然  阅读(115)  评论(0)    收藏  举报