The following lines contain the word 'select', 'insert', 'update' or 'delete':
CURSOR batch_size IS SELECT system_batch_size FROM cn_repositories WHERE org_id = x_org_id;
cn_process_audits_pkg.insert_row(x_rowid, x_proc_audit_id, NULL,
'NOT', 'Notification run', NULL, NULL, NULL, NULL, NULL, SYSDATE, NULL, x_org_id);
SELECT r.clawback_grace_days
INTO x_clb_grace_period
FROM cn_periods p
,cn_repositories r
,gl_sets_of_books s
WHERE r.current_period_id = p.period_id(+)
AND r.application_id = 283
AND r.set_of_books_id = s.set_of_books_id
AND r.org_id = x_org_id
AND r.org_id=p.org_id(+);
INSERT INTO cn_not_trx (
not_trx_id,
batch_id,
notified_date,
processed_date,
notification_run_id,
collected_flag,
row_id,
source_trx_id,
source_doc_type,
event_id,
org_id)
SELECT
cn_not_trx_s.NEXTVAL,
FLOOR(cn_not_trx_s.CURRVAL/l_sys_batch_size),
SYSDATE,
x_end_date,
x_proc_audit_id,
'N',
aps.rowid,
aps.payment_schedule_id,
'AR',
cn_global.cbk_event_id,
x_org_id
FROM ar_payment_schedules aps,
ra_customer_trx rct,
ra_cust_trx_types rctt,
ra_cust_trx_line_gl_dist rctlgd,
cn_repositories cr
WHERE aps.due_date BETWEEN x_start_due_date AND x_end_due_date
AND aps.amount_line_items_remaining > 0
--AE AND aps.class in ('INV', 'CM') --AE 02-06-96
AND aps.customer_trx_id = rct.customer_trx_id --AE 02-07-96
AND rct.customer_trx_id = rctlgd.customer_trx_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id
AND rct.complete_flag = 'Y'
AND rctt.type in ('INV', 'CM')
AND rctlgd.account_class = 'REC'
AND rctlgd.latest_rec_flag = 'Y'
AND rctlgd.posting_control_id <> -3
AND rct.set_of_books_id = cr.set_of_books_id --AE 02-21-96
AND cr.repository_id = 100 --AE 02-21-96
AND aps.org_id = x_org_id
AND rct.org_id = aps.org_id
AND rctt.org_id = rct.org_id
AND rctlgd.org_id = rctt.org_id
AND cr.org_id = rctlgd.org_id
AND NOT EXISTS (
SELECT 1
FROM cn_not_trx
WHERE source_trx_id = aps.payment_schedule_id
AND event_id= cn_global.cbk_event_id
AND org_id = x_org_id) ;
cn_process_audits_pkg.update_row(x_proc_audit_id, NULL, SYSDATE, 0,
'Finished notification run: Notified ' || x_trx_count || ' clawbacks.');
cn_message_pkg.debug('notify_clawbacks: No rows inserted into CN_NOT_TRX. Possible reason: Transactions have not been posted to GL or they have already been collected.');
fnd_file.put_line(fnd_file.Log, 'notify_clawbacks: No rows inserted into CN_NOT_TRX. Possible reason: Transactions have not been posted to GL or they have already been collected.');
cn_process_audits_pkg.update_row(X_proc_audit_id, NULL, SYSDATE, SQLCODE,
SQLERRM);