The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* Update the ordered_date with the system date */
l_header_rec.ordered_date := SYSDATE;
l_header_rec.last_updated_by := FND_GLOBAL.USER_ID;
l_header_rec.last_update_date := SYSDATE;
l_header_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
UPDATE oe_order_headers
SET ordered_date = l_header_rec.ordered_date
, last_updated_by = l_header_rec.last_updated_by
, last_update_date = l_header_rec.last_update_date
, last_update_login = l_header_rec.last_update_login
WHERE header_id = p_header_id;
/* Update the Header Cache with the new information */
OE_Order_Cache.Set_Order_Header(l_header_rec);
oe_debug_pub.add('OEXGRMAB: AFTER CALLING UPDATE FLOW STATUS CODE, RETURN STATUS: '||X_RETURN_STATUS);
SELECT nvl(sum(ordered_quantity), 0)
INTO l_already_returned
FROM oe_order_lines
WHERE reference_line_id = p_line_tbl(l_index).reference_line_id
AND cancelled_flag <> 'Y'
AND line_category_code = 'RETURN'
AND line_id <> p_line_tbl(l_index).line_id;
SELECT nvl(ordered_quantity, 0)
INTO l_original_ordered
FROM oe_order_lines
WHERE line_id = p_line_tbl(l_index).reference_line_id;
SELECT wv.NOTIFICATION_ID
FROM
(
select IAS.NOTIFICATION_ID NOTIFICATION_ID, IAS.END_DATE END_DATE
from WF_PROCESS_ACTIVITIES PA,
WF_ITEM_ACTIVITY_STATUSES IAS
where IAS.ITEM_TYPE = itemtype
and IAS.ITEM_KEY = itemkey
and PA.ACTIVITY_NAME = 'RMA_ORDER_APPROVAL_NTF'
and IAS.NOTIFICATION_ID is not null
and IAS.PROCESS_ACTIVITY = PA.INSTANCE_ID
UNION ALL
select IAS.NOTIFICATION_ID, IAS.END_DATE
from WF_PROCESS_ACTIVITIES PA,
WF_ITEM_ACTIVITY_STATUSES_H IAS
where IAS.ITEM_TYPE = itemtype
and IAS.ITEM_KEY = itemkey
and PA.ACTIVITY_NAME = 'RMA_ORDER_APPROVAL_NTF'
and IAS.NOTIFICATION_ID is not null
and IAS.PROCESS_ACTIVITY = PA.INSTANCE_ID
) wv
ORDER BY wv.end_date DESC ;
SELECT order_source_id
INTO l_order_source_id
FROM oe_order_headers
WHERE header_id = to_number(itemkey);
SELECT wv.NOTIFICATION_ID
FROM
(
select IAS.NOTIFICATION_ID NOTIFICATION_ID, IAS.END_DATE END_DATE
from WF_PROCESS_ACTIVITIES PA,
WF_ITEM_ACTIVITY_STATUSES IAS
where IAS.ITEM_TYPE = itemtype
and IAS.ITEM_KEY = itemkey
and PA.ACTIVITY_NAME = 'RMA_ORDER_APPROVAL_NTF'
and IAS.NOTIFICATION_ID is not null
and IAS.PROCESS_ACTIVITY = PA.INSTANCE_ID
UNION ALL
select IAS.NOTIFICATION_ID, IAS.END_DATE
from WF_PROCESS_ACTIVITIES PA,
WF_ITEM_ACTIVITY_STATUSES_H IAS
where IAS.ITEM_TYPE = itemtype
and IAS.ITEM_KEY = itemkey
and PA.ACTIVITY_NAME = 'RMA_ORDER_APPROVAL_NTF'
and IAS.NOTIFICATION_ID is not null
and IAS.PROCESS_ACTIVITY = PA.INSTANCE_ID
) wv
ORDER BY wv.end_date DESC ;
/* Update the Rejection Reason */
IF OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510' THEN
/* Check if Rejection Reason has been setup in RMA_REJECTION_REASON lookup */
BEGIN
SELECT 'Y'
INTO l_reason_exists
FROM oe_lookups
WHERE lookup_type = 'RMA_REJECTION_REASON'
AND lookup_code = l_reason_code;
SELECT order_source_id
INTO l_order_source_id
FROM oe_order_headers
WHERE header_id = to_number(itemkey);