Sunday, December 6, 2009

и такое можно...


Select CGH_CHILD_NODE into v_parent from
    (
      Select CGH_CHILD_NODE, lvl from
      (
          Select CGH_CHILD_NODE, Level as lvl
          from (Select cgh_child_node,cgh_parentnode from
          PS_CBO_OH_TREE_VW where cgh_yyyy_period = v_period)
          CONNECT BY PRIOR CGH_PARENTNODE = CGH_CHILD_NODE
          START WITH CGH_CHILD_NODE = i.child_node
           )
          where
          CGH_CHILD_NODE <> i.child_node and
       CGH_CHILD_NODE IN (select SUBSTR(bus_node,1,INSTR(bus_node,'-')-1)
       from TABLE(cast(v_bo_rep_data1 as PS_cbo_indent_Attr_rep_Type)))
    order by lvl asc
    )
where rownum = 1;


снег выпал только в декабре.

No comments: