The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT spq.period_quota_id,
spq.period_id,
spq.quota_id,
spq.quarter_num,
spq.period_year
FROM cn_period_quotas spq,
cn_acc_period_statuses_v cp,
cn_cal_per_int_types cpit,
cn_quotas cq
WHERE spq.quota_id = p_quota_id
AND spq.quota_id = cq.quota_id
AND spq.period_id = cp.period_id
AND cp.period_id = cpit.cal_period_id
AND cpit.interval_type_id = cq.interval_type_id
AND cpit.interval_number = l_interval_number
AND spq.period_year = l_period_year
ORDER BY spq.period_id;
SELECT COUNT (spq.period_quota_id) interval_count,
cpit.interval_number interval_number,
spq.period_year period_year
FROM cn_period_quotas spq,
cn_acc_period_statuses_v cp,
cn_cal_per_int_types cpit,
cn_quotas cq
WHERE spq.quota_id = p_quota_id
AND spq.quota_id = cq.quota_id
AND spq.period_id = cp.period_id
AND cp.period_id = cpit.cal_period_id
AND cpit.interval_type_id = cq.interval_type_id
GROUP BY cpit.interval_number,
spq.period_year;
SELECT NVL (q.target, 0),
NVL (q.payment_amount, 0),
NVL (q.performance_goal, 0)
--,qa.period_target_dist_rule_code
,
cn_chk_plan_element_pkg.get_interval_name (q.interval_type_id,q.org_id) period_type_code
INTO l_quota_target,
l_quota_payment,
l_performance_goal
--,l_dist_rule_code
,
l_period_type_code
FROM cn_quotas q
WHERE q.quota_id = p_quota_id
--AND qa.period_target_dist_rule_code <> 'USER_DEFINED'
;
/* UPDATE cn_srp_period_quotas
SET
target_amount = round(nvl(l_period_target, 0), g_ext_precision),
itd_target = round(nvl(l_running_total_target,0), g_ext_precision),
period_payment = round(nvl(l_period_payment,0), g_ext_precision),
itd_payment = round(nvl(l_running_total_payment,0), g_ext_precision),
performance_goal_ptd = round(nvl(l_period_performance_goal,0), g_ext_precision),
performance_goal_itd = round(nvl(l_running_performance_goal,0),g_ext_precision)
WHERE srp_period_quota_id = pq_rec.period_quota_id
;*/
cn_period_quotas_pkg.begin_record (x_operation => 'UPDATE',
x_period_quota_id => pq_rec.period_quota_id,
x_period_id => pq_rec.period_id,
x_quota_id => pq_rec.quota_id,
x_period_target => NVL (l_period_target, 0),
x_itd_target => NVL (l_running_total_target, 0),
x_period_payment => NVL (l_period_payment, 0),
x_itd_payment => NVL (l_running_total_payment, 0),
x_quarter_num => pq_rec.quarter_num,
x_period_year => pq_rec.period_year,
x_creation_date => SYSDATE,
x_last_update_date => SYSDATE,
x_last_update_login => fnd_global.login_id,
x_last_updated_by => fnd_global.user_id,
x_created_by => fnd_global.user_id,
x_period_type_code => 'PERIOD',
x_performance_goal => NVL (l_period_performance_goal, 0)
);
G_LAST_UPDATE_DATE DATE := sysdate;
G_LAST_UPDATED_BY NUMBER := fnd_global.user_id;
G_LAST_UPDATE_LOGIN NUMBER := fnd_global.login_id;
SELECT *
from cn_quotas
where name = p_quota_name
AND org_id = l_org_id;
SELECT period_quota_id, quarter_num, period_year, period_id, itd_target, itd_payment, performance_goal_itd
FROM cn_period_quotas
WHERE quota_id = p_quota_id;
SELECT *
from cn_quotas
where quota_id = p_quota_id;
select *
from cn_period_statuses
where period_name = p_period_name
and org_id = l_org_id;
select *
from cn_period_quotas
where quota_id = p_quota_id
and period_id = p_period_id;
select nvl(target, 0)
into f_target_amount
from cn_quotas
where quota_id = l_quota_id;
select nvl(target, 0)
into f_target_amount
from cn_quotas
where quota_id = l_quota_id;
x_operation => 'UPDATE'
,x_rowid => G_ROWID
,x_quota_id => f_quota_row_rec.quota_id
,x_name => f_quota_row_rec.name
,x_object_version_number => f_quota_row_rec.object_version_number
,x_target => f_target_amount
,x_quota_type_code => f_quota_row_rec.quota_type_code
,x_usage_code => NULL
,x_payment_amount => f_quota_row_rec.payment_amount
,x_description => f_quota_row_rec.description
,x_start_date => f_quota_row_rec.start_date
,x_end_date => f_quota_row_rec.end_date
,x_quota_status => f_quota_row_rec.quota_status
,x_calc_formula_id => f_quota_row_rec.calc_formula_id
,x_incentive_type_code => f_quota_row_rec.incentive_type_code
,x_credit_type_id => f_quota_row_rec.credit_type_id
,x_rt_sched_custom_flag => f_quota_row_rec.rt_sched_custom_flag
,x_package_name => f_quota_row_rec.package_name
,x_performance_goal => f_quota_row_rec.performance_goal
,x_interval_type_id => f_quota_row_rec.interval_type_id
,x_payee_assign_flag => f_quota_row_rec.payee_assign_flag
,x_vesting_flag => f_quota_row_rec.vesting_flag
,x_expense_account_id => f_quota_row_rec.expense_account_id
,x_liability_account_id => f_quota_row_rec.liability_account_id
,x_quota_group_code => f_quota_row_rec.quota_group_code
,x_quota_unspecified => NULL
,x_last_update_date => G_LAST_UPDATE_DATE
,x_last_updated_by => G_LAST_UPDATED_BY
,x_creation_date => G_CREATION_DATE
,x_created_by => G_CREATED_BY
,x_last_update_login => G_LAST_UPDATE_LOGIN
,x_program_type => G_PROGRAM_TYPE
--,x_status_code => NULL
,x_period_type_code => NULL
,x_start_num => NULL
,x_end_num => NULL
,x_addup_from_rev_class_flag => f_quota_row_rec.addup_from_rev_class_flag
,x_attribute1 => f_quota_row_rec.attribute1
,x_attribute2 => f_quota_row_rec.attribute2
,x_attribute3 => f_quota_row_rec.attribute3
,x_attribute4 => f_quota_row_rec.attribute4
,x_attribute5 => f_quota_row_rec.attribute5
,x_attribute6 => f_quota_row_rec.attribute6
,x_attribute7 => f_quota_row_rec.attribute7
,x_attribute8 => f_quota_row_rec.attribute8
,x_attribute9 => f_quota_row_rec.attribute9
,x_attribute10 => f_quota_row_rec.attribute10
,x_attribute11 => f_quota_row_rec.attribute11
,x_attribute12 => f_quota_row_rec.attribute12
,x_attribute13 => f_quota_row_rec.attribute13
,x_attribute14 => f_quota_row_rec.attribute14
,x_attribute15 => f_quota_row_rec.attribute15
,x_payment_group_code => 'STANDARD'
,x_indirect_credit => f_quota_row_rec.indirect_credit
,x_org_id=> f_quota_row_rec.org_id
,x_salesrep_end_flag => f_quota_row_rec.salesreps_enddated_flag
);
select nvl(payment_amount, 0)
into f_fixed_amount
from cn_quotas
where quota_id = l_quota_id;
select nvl(payment_amount, 0)
into f_fixed_amount
from cn_quotas
where quota_id = l_quota_id;
x_operation => 'UPDATE'
,x_rowid => G_ROWID
,x_quota_id => f_quota_row_rec.quota_id
,x_name => f_quota_row_rec.name
,x_object_version_number => f_quota_row_rec.object_version_number
,x_target => f_quota_row_rec.target
,x_quota_type_code => f_quota_row_rec.quota_type_code
,x_usage_code => NULL
,x_payment_amount => f_fixed_amount
,x_description => f_quota_row_rec.description
,x_start_date => f_quota_row_rec.start_date
,x_end_date => f_quota_row_rec.end_date
,x_quota_status => f_quota_row_rec.quota_status
,x_calc_formula_id => f_quota_row_rec.calc_formula_id
,x_incentive_type_code => f_quota_row_rec.incentive_type_code
,x_credit_type_id => f_quota_row_rec.credit_type_id
,x_rt_sched_custom_flag => f_quota_row_rec.rt_sched_custom_flag
,x_package_name => f_quota_row_rec.package_name
,x_performance_goal => f_quota_row_rec.performance_goal
,x_interval_type_id => f_quota_row_rec.interval_type_id
,x_payee_assign_flag => f_quota_row_rec.payee_assign_flag
,x_vesting_flag => f_quota_row_rec.vesting_flag
,x_expense_account_id => f_quota_row_rec.expense_account_id
,x_liability_account_id => f_quota_row_rec.liability_account_id
,x_quota_group_code => f_quota_row_rec.quota_group_code
,x_quota_unspecified => NULL
,x_last_update_date => G_LAST_UPDATE_DATE
,x_last_updated_by => G_LAST_UPDATED_BY
,x_creation_date => G_CREATION_DATE
,x_created_by => G_CREATED_BY
,x_last_update_login => G_LAST_UPDATE_LOGIN
,x_program_type => G_PROGRAM_TYPE
--,x_status_code => NULL
,x_period_type_code => NULL
,x_start_num => NULL
,x_end_num => NULL
,x_addup_from_rev_class_flag => f_quota_row_rec.addup_from_rev_class_flag
,x_attribute1 => f_quota_row_rec.attribute1
,x_attribute2 => f_quota_row_rec.attribute2
,x_attribute3 => f_quota_row_rec.attribute3
,x_attribute4 => f_quota_row_rec.attribute4
,x_attribute5 => f_quota_row_rec.attribute5
,x_attribute6 => f_quota_row_rec.attribute6
,x_attribute7 => f_quota_row_rec.attribute7
,x_attribute8 => f_quota_row_rec.attribute8
,x_attribute9 => f_quota_row_rec.attribute9
,x_attribute10 => f_quota_row_rec.attribute10
,x_attribute11 => f_quota_row_rec.attribute11
,x_attribute12 => f_quota_row_rec.attribute12
,x_attribute13 => f_quota_row_rec.attribute13
,x_attribute14 => f_quota_row_rec.attribute14
,x_attribute15 => f_quota_row_rec.attribute15
,x_payment_group_code => 'STANDARD'
,x_indirect_credit => f_quota_row_rec.indirect_credit
,x_org_id=> f_quota_row_rec.org_id
,x_salesrep_end_flag => f_quota_row_rec.salesreps_enddated_flag
);
select nvl(performance_goal, 0)
into f_performance_goal
from cn_quotas
where quota_id = l_quota_id;
select nvl(performance_goal, 0)
into f_performance_goal
from cn_quotas
where quota_id = l_quota_id;
x_operation => 'UPDATE'
,x_rowid => G_ROWID
,x_quota_id => f_quota_row_rec.quota_id
,x_name => f_quota_row_rec.name
,x_object_version_number => f_quota_row_rec.object_version_number
,x_target => f_quota_row_rec.target
,x_quota_type_code => f_quota_row_rec.quota_type_code
,x_usage_code => NULL
,x_payment_amount => f_quota_row_rec.payment_amount
,x_description => f_quota_row_rec.description
,x_start_date => f_quota_row_rec.start_date
,x_end_date => f_quota_row_rec.end_date
,x_quota_status => f_quota_row_rec.quota_status
,x_calc_formula_id => f_quota_row_rec.calc_formula_id
,x_incentive_type_code => f_quota_row_rec.incentive_type_code
,x_credit_type_id => f_quota_row_rec.credit_type_id
,x_rt_sched_custom_flag => f_quota_row_rec.rt_sched_custom_flag
,x_package_name => f_quota_row_rec.package_name
,x_performance_goal => f_performance_goal
,x_interval_type_id => f_quota_row_rec.interval_type_id
,x_payee_assign_flag => f_quota_row_rec.payee_assign_flag
,x_vesting_flag => f_quota_row_rec.vesting_flag
,x_expense_account_id => f_quota_row_rec.expense_account_id
,x_liability_account_id => f_quota_row_rec.liability_account_id
,x_quota_group_code => f_quota_row_rec.quota_group_code
,x_quota_unspecified => NULL
,x_last_update_date => G_LAST_UPDATE_DATE
,x_last_updated_by => G_LAST_UPDATED_BY
,x_creation_date => G_CREATION_DATE
,x_created_by => G_CREATED_BY
,x_last_update_login => G_LAST_UPDATE_LOGIN
,x_program_type => G_PROGRAM_TYPE
--,x_status_code => NULL
,x_period_type_code => NULL
,x_start_num => NULL
,x_end_num => NULL
,x_addup_from_rev_class_flag => f_quota_row_rec.addup_from_rev_class_flag
,x_attribute1 => f_quota_row_rec.attribute1
,x_attribute2 => f_quota_row_rec.attribute2
,x_attribute3 => f_quota_row_rec.attribute3
,x_attribute4 => f_quota_row_rec.attribute4
,x_attribute5 => f_quota_row_rec.attribute5
,x_attribute6 => f_quota_row_rec.attribute6
,x_attribute7 => f_quota_row_rec.attribute7
,x_attribute8 => f_quota_row_rec.attribute8
,x_attribute9 => f_quota_row_rec.attribute9
,x_attribute10 => f_quota_row_rec.attribute10
,x_attribute11 => f_quota_row_rec.attribute11
,x_attribute12 => f_quota_row_rec.attribute12
,x_attribute13 => f_quota_row_rec.attribute13
,x_attribute14 => f_quota_row_rec.attribute14
,x_attribute15 => f_quota_row_rec.attribute15
,x_payment_group_code => 'STANDARD'
,x_indirect_credit => f_quota_row_rec.indirect_credit
,x_org_id=> f_quota_row_rec.org_id
,x_salesrep_end_flag => f_quota_row_rec.salesreps_enddated_flag
);
x_operation => 'UPDATE',
X_period_quota_id => tbl_period_quota_id,
x_period_id => tbl_period_id,
x_quota_id => l_quota_id,
x_period_target => p_prd_quota_tbl(i).PERIOD_TARGET,
x_itd_target => NULL,
x_period_payment => p_prd_quota_tbl(i).PERIOD_PAYMENT ,
x_itd_payment => NULL,
x_quarter_num => tbl_quarter_num,
x_period_year => tbl_period_year,
x_creation_date => sysdate,
x_last_update_date => sysdate,
x_last_update_login => fnd_global.login_id,
x_last_updated_by => fnd_global.user_id,
x_created_by => fnd_global.user_id,
x_period_type_code => 'PERIOD',
x_performance_goal => p_prd_quota_tbl(i).PERFORMANCE_GOAL);