SELECT bmba001 主件料件,(select IMAAL003 from IMAAL_T where IMAAL001=bmba001) ,(select IMAAL004 from IMAAL_T where IMAAL001=bmba001) ,imaf013,case imaf013
when '1' then '采'
when '2' then '自'
when '3' then '外'
else '无' end ,
bmba009,bmba003 元件料号 FROM (
SELECT DISTINCT bmba001,bmba009,bmba003,eval_number(LTRIM(sys_connect_by_path(bmba011/bmba012,'*'),'*')) AS yl,to_char(sys_connect_by_path(bmba003,'/')),LEVEL lev,bmba002,
bmba011,bmba012
FROM bmba_t WHERE bmbaent=5 AND bmba005 <= SYSDATE AND (bmba006 > SYSDATE OR bmba006 IS NULL ) START WITH bmba001='10100300100008'
CONNECT BY PRIOR bmba003=bmba001)
JOIN IMAF_T on bmba001=imaf001
ORDER BY lev,bmba001,bmba009