The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT frv.responsibility_id
FROM fnd_responsibility frv,
fnd_compiled_menu_functions fcmf,
fnd_form_functions fff,
fnd_user_resp_groups_direct urg
WHERE fff.function_name = 'AR_CASH_APPLN_WORK_QUEUE'
AND fcmf.function_id = fff.function_id
AND frv.menu_id = fcmf.menu_id
AND fcmf.grant_flag = 'Y'
AND fff.function_id NOT IN
(SELECT frf.action_id
FROM fnd_resp_functions frf
WHERE frf.action_id = fff.function_id
AND frf.rule_type = 'F'
AND frf.application_id = 222
AND frf.responsibility_id = frv.responsibility_id)
AND curr_date BETWEEN nvl(urg.start_date, curr_date)
AND nvl(urg.end_date, curr_date)
AND urg.user_id = user_id_bind
AND urg.responsibility_id = frv.responsibility_id
AND frv.application_id = 222;
SELECT frv.responsibility_id
FROM fnd_responsibility frv,
fnd_compiled_menu_functions fcmf,
fnd_form_functions fff,
fnd_user_resp_groups_direct urg
WHERE fff.function_name = 'AR_CASH_APPLN_WORK_QUEUE'
AND fcmf.function_id = fff.function_id
AND frv.menu_id = fcmf.menu_id
AND urg.user_id = user_id_bind
AND urg.responsibility_id = frv.responsibility_id
AND frv.application_id = 222;
C_receipt_stmt := 'SELECT acr.cash_receipt_id, ' ||
'hca.cust_account_id, ' ||
'hcsu.site_use_id, '||
'nvl(hcp1.profile_class_id, hcp.profile_class_id) profile_class_id, '||
'hl.country, '||
'acr.org_id, '||
'acr.currency_code, '||
'decode(acr.status, ''UNID'', ABS(aps.amount_due_remaining), 0) unidentified_amount, '||
'decode(acr.status, ''UNAPP'', ABS(aps.amount_due_remaining), 0) unapplied_amount '||
'FROM ar_cash_receipts acr, '||
'hz_cust_accounts hca, '||
'hz_cust_site_uses hcsu, '||
'hz_locations hl, '||
'hz_party_sites hps, '||
'hz_cust_acct_sites hcas, '||
'ar_payment_schedules aps, '||
'hz_customer_profiles hcp, '||
'hz_customer_profiles hcp1 '||
'WHERE acr.pay_from_customer = hca.cust_account_id(+) '||
'AND acr.customer_site_use_id = hcsu.site_use_id(+) '||
'AND hcsu.cust_acct_site_id = hcas.cust_acct_site_id(+) '||
'AND hcas.party_site_id = hps.party_site_id(+) '||
'AND hps.location_id = hl.location_id(+) '||
'AND acr.cash_receipt_id = aps.cash_receipt_id '||
'AND acr.type = ''CASH'' '||
'AND acr.cash_appln_owner_id IS NULL '||
'AND acr.status IN(''UNAPP'', ''UNID'') '||
'AND hca.cust_account_id = hcp.cust_account_id(+) '||
'AND hcp.site_use_id IS NULL '||
'AND hcsu.site_use_id = hcp1.site_use_id(+) '||
'and mod(acr.cash_receipt_id,'|| l_max_num_workers ||
') = decode( ' ||l_max_num_workers ||
', 0, acr.cash_receipt_id, mod(' || l_worker_no|| ','|| l_max_num_workers || '))';
delete from AR_CASH_RECPT_RULE_PARAM_GT;
INSERT INTO AR_CASH_RECPT_RULE_PARAM_GT values receipts_tab(i);
SELECT ID, RESULT_VALUE BULK COLLECT INTO results_tab from FUN_RULE_BULK_RESULT_GT;
/* Update the AR_Cash_Receipts table with the result values */
FORALL i in results_tab.cash_receipt_id.first..results_tab.cash_receipt_id.last
UPDATE ar_cash_receipts_all
set CASH_APPLN_OWNER_ID = results_tab.cash_appln_owner_id(i),
WORK_ITEM_ASSIGNMENT_DATE = sysdate,
WORK_ITEM_STATUS_CODE = 'NEW'
where CASH_RECEIPT_ID = results_tab.cash_receipt_id(i);
delete from FUN_RULE_BULK_RESULT_GT;