I have the below two Statements below the Count gives me a differrent value. Can any one help me.
SELECT COUNT(*)
FROM apps.oe_order_headers_all h,
apps.oe_transaction_types_tl t,
apps.oe_order_lines_all l
WHERE h.header_id = l.header_id
AND h.order_type_id = t.transaction_type_id
AND h.order_category_code = 'RETURN'
AND h.org_id = 183
AND h.booked_flag = 'N'
AND h.last_update_date < SYSDATE - 90
AND h.sales_channel_code IN ('A','B','C','D','I')
AND t.language = 'US'
AND t.name LIKE 'RMA%'
--94724
SELECT COUNT(*) FROM apps.oe_order_headers_all h
WHERE EXISTS ( SELECT 1
FROM apps.oe_order_lines_all l,
apps.oe_transaction_types_tl t
WHERE h.header_id = l.header_id
AND h.order_type_id = t.transaction_type_id
AND h.order_category_code = 'RETURN'
AND h.org_id = 183
AND h.booked_flag = 'N'
AND h.last_update_date < SYSDATE - 90
AND h.sales_channel_code IN ('A','B','C','D','I')
AND t.language = 'US'
AND t.name LIKE 'RMA%')
--1466
The second i will be replacing a delete instead of COUNT(*).
Bookmarks