Here's my final code, if anyone cares:

Code:
 
    strSQL = "SELECT MAX(b2.top_assy_1) OVER (PARTITION BY grp_num)  AS top_assy "
    strSQL = strSQL & ", b2.bill_lvl     AS bill_lvl "
    strSQL = strSQL & ", b2.comp_part_nbr    AS comp_part_nbr "
    strSQL = strSQL & ", cp.part_desc      AS c_part_desc "
    strSQL = strSQL & ", cp.part_type      AS c_part_type "
    strSQL = strSQL & ", b2.qty_per      AS qty_c_per_p "
    strSQL = strSQL & ", b2.qty_per_type     AS c_qty_type "
    strSQL = strSQL & ", cp.qty_on_hand      AS c_qty_on_hand "
    strSQL = strSQL & ", b2.bom_doc_nbr      AS parent_part_nbr "
    strSQL = strSQL & ", pp.part_desc      AS p_part_desc "
    strSQL = strSQL & ", pp.qty_on_hand      AS p_qty_on_hand "
    strSQL = strSQL & "FROM ( "
    strSQL = strSQL & " SELECT b1.* "
    strSQL = strSQL & " , COUNT (top_assy_1) OVER (ORDER BY rnum) AS grp_num "
    strSQL = strSQL & " FROM ( "
    strSQL = strSQL & "  SELECT  c_bill.* "
    strSQL = strSQL & "  , CASE "
    strSQL = strSQL & "    WHEN LEVEL = 1 "
    strSQL = strSQL & "    THEN bom_doc_nbr "
    strSQL = strSQL & "   END   AS top_assy_1 "
    strSQL = strSQL & "  , LEVEL   AS bill_lvl "
    strSQL = strSQL & "  , ROWNUM   AS rnum "
    strSQL = strSQL & "  FROM ( "
    strSQL = strSQL & "   SELECT bill.comp_part_nbr  "
    strSQL = strSQL & "   , bill.qty_per  "
    strSQL = strSQL & "   , bill.qty_per_type  "
    strSQL = strSQL & "   , bill.oper_nbr  "
    strSQL = strSQL & "   , bill.comp_off_adj  "
    strSQL = strSQL & "   , bill.bom_doc_nbr "
    strSQL = strSQL & "   FROM  BILL bill "
    strSQL = strSQL & "   WHERE ( "
    strSQL = strSQL & "     (bill.status   = 'RL')  AND "
    strSQL = strSQL & "     (bill.view_code  <>'E')   AND "
    strSQL = strSQL & "     (bill.qty_per_type <>0)   AND "
    strSQL = strSQL & "     (bill.end_eff_dt >SYSDATE)  AND "
    strSQL = strSQL & "     (bill.begn_eff_dt <=SYSDATE) "
    strSQL = strSQL & "    ) "
    strSQL = strSQL & "   ) c_bill "
    strSQL = strSQL & "  CONNECT BY  PRIOR comp_part_nbr =bom_doc_nbr "
    strSQL = strSQL & "  ) b1 "
    strSQL = strSQL & " ) b2 "
    strSQL = strSQL & ", PART cp "
    strSQL = strSQL & ", PART pp "
    strSQL = strSQL & "WHERE b2.comp_part_nbr =cp.part_nbr AND "
    strSQL = strSQL & " b2.bom_doc_nbr  =pp.part_nbr "