SELECT ooha.header_id,
line_id,
released_status,
ooha.*
FROM
oe_order_headers_all ooha,
wsh_delivery_details wdd,
oe_order_lines_all oola
WHERE ooha.header_id = oola.header_id
AND ooha.header_id = wdd.source_header_id
AND wdd.released_status = 'B'
AND ooha.ordered_date > SYSDATE - 1
-- AND oola.ordered_item = 'NBR' -- SKU
AND NOT EXISTS
(SELECT 1
FROM wsh_delivery_details wdd1
WHERE wdd1.released_status != 'B'
AND wdd1.source_header_id = ooha.header_id);