(SELECT SUBSTR (MAX (SYS_CONNECT_BY_PATH (instance_number, ',')), 2)
FROM (SELECT ool.line_id, instance_number,
ROW_NUMBER () OVER (PARTITION BY line_id ORDER BY instance_number) rn
FROM csi_item_instances csi,
oe_order_lines_all ool
WHERE ool.line_id = oola.line_id
AND ool.line_id = csi.last_oe_order_line_id
AND ool.inventory_item_id = csi.inventory_item_id
AND TRUNC (SYSDATE) BETWEEN TRUNC (active_start_date)
AND TRUNC
(NVL (active_end_date,
SYSDATE
)
))
START WITH rn = 1
CONNECT BY PRIOR rn = rn - 1 AND PRIOR line_id = line_id) "IB Instance #",
No comments:
Post a Comment