查看資料:
SELECT h.order_number,
h.header_id,
l.line_number
|| '.'
|| l.shipment_number
|| '.'
|| l.option_number
|| '.'
|| l.component_number
|| '.'
|| l.service_number
line_num,
l.line_id,
h.booked_flag,
l.booked_flag,
h.order_type_id,
l.line_type_id,
h.creation_date,
h.last_update_date,
h.last_updated_by,
l.creation_date,
l.last_update_date,
l.last_updated_by,
DECODE (
(SELECT 1
FROM wf_items
WHERE item_type = 'OEOL'
AND item_key = TO_CHAR (l.line_id)
AND end_date IS NULL),
1, 'Yes',
'No')
WF_Created,
DECODE (
(SELECT 1
FROM wf_item_activity_statuses
WHERE item_type = 'OEOL'
AND item_key = TO_CHAR (l.line_id)
AND end_date IS NULL
AND ROWNUM = 1),
1, 'Yes',
'No')
WF_Started
FROM oe_order_lines_all l, oe_order_headers_all h
WHERE l.header_id = h.header_id
AND l.open_flag = 'Y'
AND h.open_flag = 'Y'
AND h.flow_status_code IN ('ENTERED', 'BOOKED')
AND l.flow_status_code IN ('ENTERED', 'BOOKED')
AND NOT EXISTS
(SELECT 1
FROM wf_item_activity_statuses st
WHERE st.item_type = 'OEOL'
AND st.item_key = TO_CHAR (l.line_id))
and h.order_number =102013860