The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT start_date
FROM cn_period_statuses_all
WHERE period_id = p_period_id
AND ((org_id = p_org_id) OR (org_id IS NULL AND p_org_id IS NULL));
SELECT end_date
FROM cn_period_statuses_all
WHERE period_id = p_period_id
AND ((org_id = p_org_id) OR (org_id IS NULL AND p_org_id IS NULL));
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where upper(profile_option_name) = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where upper(profile_option_name) = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where upper(profile_option_name) = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where upper(profile_option_name) = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where upper(profile_option_name) = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where profile_option_name = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
SELECT profile_option_value
from fnd_profile_option_values
where profile_option_id =
(select profile_option_id
from fnd_profile_options
where profile_option_name = 'CN_UPGRADING_FROM_RELEASE'
and application_id = 283)
and level_id = 10001
and application_id = 283;
l_update_name VARCHAR2(30) := 'CNSCNUPD12.0.9';
ad_parallel_updates_pkg.initialize_rowid_range(
ad_parallel_updates_pkg.ROWID_RANGE,
l_table_owner,
l_table_name,
l_update_name,
l_worker_id,
l_num_workers,
l_batch_size, 0);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_END_rowid,
l_any_rows_to_process,
l_batch_size,
TRUE);
UPDATE /*+ ROWID (clp) */ cn_comm_lines_api_all clp
SET clp.preserve_credit_override_flag = NVL(clp.preserve_credit_override_flag,'N'),
clp.adjust_status = NVL(clp.adjust_status,'NEW')
WHERE ROWID BETWEEN l_start_rowid AND l_end_rowid
AND ( CLP.PRESERVE_CREDIT_OVERRIDE_FLAG IS NULL
OR CLP.ADJUST_STATUS IS NULL)
AND EXISTS ( SELECT NULL
FROM cn_period_statuses_all status
WHERE status.org_id = clp.org_id
AND clp.processed_date BETWEEN status.start_date AND status.end_date
AND status.period_status = 'O'
);
fnd_file.put_line(FND_FILE.LOG, l_rows_processed ||' rows updated ');
ad_parallel_updates_pkg.processed_rowid_range(l_rows_processed,l_END_rowid);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_end_rowid,
l_any_rows_to_process,
l_batch_size,
FALSE);
fnd_file.put_line(FND_FILE.LOG, 'Total number of Comm Lines API rows that are updated with NVL(adjust_status,NEW); NVL(PRESERVE_CREDIT_OVERRIDE_FLAG,N) = '||l_total_rows);
l_update_name VARCHAR2(30) := 'CNADSUPD12.0.9';
ad_parallel_updates_pkg.initialize_rowid_range(
ad_parallel_updates_pkg.ROWID_RANGE,
l_table_owner,
l_table_name,
l_update_name,
l_worker_id,
l_num_workers,
l_batch_size, 0);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_END_rowid,
l_any_rows_to_process,
l_batch_size,
TRUE);
UPDATE /*+ ROWID (cha) */ CN_COMMISSION_HEADERS_ALL cha
SET cha.adjust_status = NVL(cha.adjust_status,'NEW')
WHERE ROWID BETWEEN l_start_rowid AND l_end_rowid
AND cha.adjust_status IS NULL
AND EXISTS (SELECT NULL
FROM cn_period_statuses_all status
WHERE status.org_id = cha.org_id
AND cha.processed_date BETWEEN status.start_date AND status.end_date
AND status.period_status = 'O'
);
fnd_file.put_line(FND_FILE.LOG, l_rows_processed ||' rows updated ');
ad_parallel_updates_pkg.processed_rowid_range(l_rows_processed,l_END_rowid);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_end_rowid,
l_any_rows_to_process,
l_batch_size,
FALSE);
fnd_file.put_line(FND_FILE.LOG, 'Total number of Commission Headers rows that are updated with NVL(adjust_status,NEW) = '||l_total_rows);
l_update_name VARCHAR2(30) := 'CNSRPTXN';
SELECT release_name
FROM FND_PRODUCT_GROUPS;
l_update_name := 'CNSRPTXN';
l_update_name := 'CNSRPTXN_2_3';
l_update_name := 'CNSRPTXN';
ad_parallel_updates_pkg.initialize_rowid_range(
ad_parallel_updates_pkg.ROWID_RANGE,
l_table_owner,
l_table_name,
l_update_name,
l_worker_id,
l_num_workers,
l_batch_size, 0);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_END_rowid,
l_any_rows_to_process,
l_batch_size,
TRUE);
/* For bug 10149831 - only OPEN periods records are filtered and updated with this dml
There should be another script which takes care of the CLOSED periods - this has to be
performed to ensure closed period when opened again has correct reference to the
transaction_amount_ptd
*/
WHILE (l_any_rows_to_process = TRUE) LOOP
BEGIN
UPDATE /*+ ROWID(srp) */ cn_srp_period_quotas_all srp
SET srp.transaction_amount_ptd = (
SELECT NVL(SUM(ch.transaction_amount), 0)
FROM cn_commission_lines_all cl,
cn_commission_headers_all ch
WHERE cl.credited_salesrep_id = srp.salesrep_id
AND cl.processed_period_id = srp.period_id
AND cl.quota_id = srp.quota_id
AND cl.srp_plan_assign_id = srp.srp_plan_assign_id
AND cl.status = 'CALC'
AND cl.commission_header_id = ch.commission_header_id)
WHERE srp.ROWID BETWEEN l_start_rowid AND l_end_rowid
AND EXISTS ( SELECT null
FROM CN_PERIOD_STATUSES_ALL psa
WHERE psa.period_status = 'O'
AND psa.period_id = srp.period_id
AND psa.org_id = srp.org_id);
fnd_file.put_line(FND_FILE.LOG, l_rows_processed ||' rows updated ');
ad_parallel_updates_pkg.processed_rowid_range(l_rows_processed,l_END_rowid);
ad_parallel_updates_pkg.get_rowid_range(
l_start_rowid,
l_end_rowid,
l_any_rows_to_process,
l_batch_size,
FALSE);
fnd_file.put_line(FND_FILE.LOG, 'Total number of SRP Period Quotas rows that are updated to populate transaction_amount_ptd = '||l_total_rows);