The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT pmt_plan_id
FROM cn_pmt_plans
WHERE name = p_PmtPlan_rec.name
AND start_date = p_PmtPlan_rec.start_date
AND end_date = p_PmtPlan_rec.end_date
AND org_id = p_PmtPlan_rec.org_id;
SELECT pmt_plan_id
FROM cn_pmt_plans
WHERE name = p_PmtPlan_rec.name
AND start_date = p_PmtPlan_rec.start_date
AND org_id = p_PmtPlan_rec.org_id;
SELECT nvl(p_PmtPlan_rec.pmt_plan_id,cn_pmt_plans_s.nextval)
INTO x_pmt_plan_id
FROM dual;
SELECT nvl(p_PmtPlan_rec.pmt_plan_id,cn_pmt_plans_s.nextval)
INTO x_pmt_plan_id
FROM dual;
SELECT credit_type_id
FROM cn_credit_types
WHERE name = p_PmtPlan_rec.credit_type_name
and org_id = p_PmtPlan_rec.org_id;
SELECT interval_type_id
FROM cn_interval_types
WHERE name = p_pmtplan_rec.pay_interval_type_name
and org_id = p_PmtPlan_rec.org_id;
IF g_mode = 'INSERT'
THEN
IF ( (cn_api.chk_miss_char_para
(p_char_para => p_PmtPlan_rec.credit_type_name,
p_para_name => 'Credit Type Name',
p_loading_status => x_loading_status,
x_loading_status => x_loading_status)) = FND_API.G_TRUE )
THEN
RAISE FND_API.G_EXC_ERROR ;
select count(1) into l_pg_count from cn_lookups
where lookup_type like 'PAYMENT_GROUP_CODE'
and lookup_code = p_PmtPlan_rec.payment_group_code;
SELECT COUNT(*)
INTO l_count
FROM cn_pmt_plans
WHERE name = p_PmtPlan_rec.name
and org_id = p_PmtPlan_rec.org_id;
L_LAST_UPDATE_DATE DATE := sysdate;
L_LAST_UPDATED_BY NUMBER := fnd_global.user_id;
L_LAST_UPDATE_LOGIN NUMBER := fnd_global.login_id;
SELECT credit_type_id
FROM cn_credit_types
WHERE name = p_PmtPlan_rec.credit_type_name
and org_id = p_PmtPlan_rec.org_id;
SELECT interval_type_id
FROM cn_interval_types
WHERE name = p_pmtplan_rec.pay_interval_type_name
and org_id = p_PmtPlan_rec.org_id;
SELECT interval_type_id
FROM cn_interval_types
WHERE name = p_pmtplan_rec.recoverable_interval_type
and org_id = p_PmtPlan_rec.org_id;
x_loading_status := 'CN_INSERTED';
g_mode := 'INSERT';
x_operation => 'INSERT',
x_rowid => L_ROWID,
x_org_id => p_PmtPlan_rec.org_id,
x_pmt_plan_id => p_PmtPlan_rec.pmt_plan_id,
x_name => p_PmtPlan_rec.name,
x_minimum_amount => p_PmtPlan_rec.minimum_amount,
x_maximum_amount => p_PmtPlan_rec.maximum_amount,
x_min_rec_flag => Nvl(p_PmtPlan_rec.min_rec_flag, 'Y'),
x_max_rec_flag => Nvl(p_PmtPlan_rec.max_rec_flag, 'Y'),
x_max_recovery_amount => p_PmtPlan_rec.max_recovery_amount,
x_credit_type_id => l_credit_type_id,
x_pay_interval_type_id => l_pay_interval_type_id,
x_start_date => p_PmtPlan_rec.start_date,
x_end_date => p_PmtPlan_rec.end_date,
x_object_version_number => p_PmtPlan_rec.object_version_number,
x_recoverable_interval_type_id => l_recoverable_interval_type_id,
x_pay_against_commission => l_pay_against_commission,
x_attribute_category => p_PmtPlan_rec.attribute_category,
x_attribute1 => p_PmtPlan_rec.attribute1,
x_attribute2 => p_PmtPlan_rec.attribute2,
x_attribute3 => p_PmtPlan_rec.attribute3,
x_attribute4 => p_PmtPlan_rec.attribute4,
x_attribute5 => p_PmtPlan_rec.attribute5,
x_attribute6 => p_PmtPlan_rec.attribute6,
x_attribute7 => p_PmtPlan_rec.attribute7,
x_attribute8 => p_PmtPlan_rec.attribute8,
x_attribute9 => p_PmtPlan_rec.attribute9,
x_attribute10 => p_PmtPlan_rec.attribute10,
x_attribute11 => p_PmtPlan_rec.attribute10,
x_attribute12 => p_PmtPlan_rec.attribute12,
x_attribute13 => p_PmtPlan_rec.attribute13,
x_attribute14 => p_PmtPlan_rec.attribute14,
x_attribute15 => p_PmtPlan_rec.attribute15,
x_last_update_date => l_last_update_date,
x_last_updated_by => l_last_updated_by,
x_creation_date => l_creation_date,
x_created_by => l_created_by,
x_last_update_login => l_last_update_login,
x_program_type => l_program_type,
x_payment_group_code => p_PmtPlan_rec.payment_group_code
);
x_loading_status := 'CN_INSERTED';
PROCEDURE Update_PmtPlan (
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_commit IN VARCHAR2,
p_validation_level IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_old_PmtPlan_rec IN PmtPlan_rec_type,
p_PmtPlan_rec IN OUT NOCOPY PmtPlan_rec_type,
x_status OUT NOCOPY VARCHAR2,
x_loading_status OUT NOCOPY VARCHAR2
) IS
l_api_name CONSTANT VARCHAR2(30) := 'Update_PmtPlan';
L_LAST_UPDATE_DATE DATE := sysdate;
L_LAST_UPDATED_BY NUMBER := fnd_global.user_id;
L_LAST_UPDATE_LOGIN NUMBER := fnd_global.login_id;
SELECT credit_type_id
FROM cn_credit_types
WHERE name = p_PmtPlan_rec.credit_type_name
and org_id = p_PmtPlan_rec.org_id;
SELECT interval_type_id
FROM cn_interval_types
WHERE name = p_pmtplan_rec.pay_interval_type_name
AND org_id = p_PmtPlan_rec.org_id;
SELECT *
FROM cn_pmt_plans
WHERE pmt_plan_id = p_pmt_plan_id
AND org_id = p_PmtPlan_rec.org_id;
SELECT name
FROM cn_credit_types
WHERE credit_type_id = l_credit_type_id
AND org_id = p_PmtPlan_rec.org_id;
SELECT name
FROM cn_interval_types
WHERE interval_type_id = l_interval_type_id
AND org_id = p_PmtPlan_rec.org_id;
SELECT nvl(object_version_number,1)
FROM cn_pmt_plans
WHERE pmt_plan_id = p_old_PmtPlan_rec.pmt_plan_id
AND org_id = p_old_PmtPlan_rec.org_id;
SELECT name
FROM cn_interval_types
WHERE interval_type_id = l_rec_interval_type_id
AND org_id = p_PmtPlan_rec.org_id;
SELECT interval_type_id
FROM cn_interval_types
WHERE name = l_rec_interval_type
AND org_id = p_PmtPlan_rec.org_id;
SAVEPOINT Update_PmtPlan;
x_loading_status := 'CN_UPDATED';
g_mode := 'UPDATE';
IF p_pmtplan_rec.start_date IS NOT NULL --start date has been updated
THEN
IF p_PmtPlan_rec.end_date IS NOT NULL
AND (p_PmtPlan_rec.start_date > p_PmtPlan_rec.end_date)
THEN
--Error condition
IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_error)
THEN
fnd_message.set_name('CN', 'CN_INVALID_DATE_RANGE');
SELECT COUNT(1)
INTO l_count
FROM cn_srp_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id;
SELECT MIN(start_date)
INTO l_start_date
FROM cn_srp_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id;
SELECT MAX(end_date)
INTO l_end_date
FROM cn_srp_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id
AND end_date IS NOT NULL;
SELECT count(1)
INTO l_null_end_date_srps
FROM cn_srp_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id
AND end_date IS NULL;
x_operation => 'UPDATE',
x_rowid => L_ROWID,
x_org_id => p_PmtPlan_rec.org_id,
x_pmt_plan_id => l_pmt_plan_id,
x_name => p_PmtPlan_rec.name,
x_minimum_amount => p_PmtPlan_rec.minimum_amount,
x_maximum_amount => p_PmtPlan_rec.maximum_amount,
x_min_rec_flag => p_PmtPlan_rec.min_rec_flag,
x_max_rec_flag => p_PmtPlan_rec.max_rec_flag,
x_max_recovery_amount => p_PmtPlan_rec.max_recovery_amount,
x_credit_type_id => l_credit_type_id,
x_pay_interval_type_id => l_pay_interval_type_id,
x_start_date => p_PmtPlan_rec.start_date,
x_end_date => p_PmtPlan_rec.end_date,
x_object_version_number => p_PmtPlan_rec.object_version_number,
x_recoverable_interval_type_id => l_recoverable_interval_type_id,
x_pay_against_commission => l_pay_against_commission,
x_attribute_category => p_PmtPlan_rec.attribute_category,
x_attribute1 => p_PmtPlan_rec.attribute1,
x_attribute2 => p_PmtPlan_rec.attribute2,
x_attribute3 => p_PmtPlan_rec.attribute3,
x_attribute4 => p_PmtPlan_rec.attribute4,
x_attribute5 => p_PmtPlan_rec.attribute5,
x_attribute6 => p_PmtPlan_rec.attribute6,
x_attribute7 => p_PmtPlan_rec.attribute7,
x_attribute8 => p_PmtPlan_rec.attribute8,
x_attribute9 => p_PmtPlan_rec.attribute9,
x_attribute10 => p_PmtPlan_rec.attribute10,
x_attribute11 => p_PmtPlan_rec.attribute10,
x_attribute12 => p_PmtPlan_rec.attribute12,
x_attribute13 => p_PmtPlan_rec.attribute13,
x_attribute14 => p_PmtPlan_rec.attribute14,
x_attribute15 => p_PmtPlan_rec.attribute15,
x_last_update_date => l_last_update_date,
x_last_updated_by => l_last_updated_by,
x_creation_date => l_creation_date,
x_created_by => l_created_by,
x_last_update_login => l_last_update_login,
x_program_type => l_program_type,
x_payment_group_code => p_PmtPlan_rec.payment_group_code
);
x_loading_status := 'CN_UPDATED';
ROLLBACK TO Update_PmtPlan;
ROLLBACK TO Update_PmtPlan;
ROLLBACK TO Update_PmtPlan;
END Update_PmtPlan;
PROCEDURE Delete_PmtPlan
( p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_commit IN VARCHAR2,
p_validation_level IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_PmtPlan_rec IN PmtPlan_rec_type ,
x_status OUT NOCOPY VARCHAR2,
x_loading_status OUT NOCOPY VARCHAR2
) IS
l_api_name CONSTANT VARCHAR2(30)
:= 'Delete_PmtPlan';
L_LAST_UPDATE_DATE DATE := sysdate;
L_LAST_UPDATED_BY NUMBER := fnd_global.user_id;
L_LAST_UPDATE_LOGIN NUMBER := fnd_global.login_id;
SAVEPOINT Delete_PmtPlan ;
x_loading_status := 'CN_DELETED';
g_mode := 'DELETE';
SELECT COUNT(1)
INTO l_count
FROM cn_srp_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id;
fnd_message.set_name('CN', 'CN_DELETE_NA');
x_loading_status := 'CN_DELETE_NA';
SELECT COUNT(1)
INTO l_count
FROM cn_role_pmt_plans
WHERE pmt_plan_id = l_pmt_plan_id;
fnd_message.set_name('CN', 'CN_DELETE_NA');
x_loading_status := 'CN_DELETE_NA';
x_operation => 'DELETE',
x_rowid => L_ROWID,
x_org_id => p_PmtPlan_rec.org_id,
x_pmt_plan_id => l_pmt_plan_id,
x_name => null,
x_minimum_amount => null,
x_maximum_amount => null,
x_min_rec_flag => null,
x_max_rec_flag => null,
x_max_recovery_amount => null,
x_credit_type_id => null,
x_pay_interval_type_id => null,
x_start_date => null,
x_end_date => null,
x_object_version_number => l_object_version_number,
x_recoverable_interval_type_id => null,
x_pay_against_commission => null,
x_attribute_category => null,
x_attribute1 => null,
x_attribute2 => null,
x_attribute3 => null,
x_attribute4 => null,
x_attribute5 => null,
x_attribute6 => null,
x_attribute7 => null,
x_attribute8 => null,
x_attribute9 => null,
x_attribute10 => null,
x_attribute11 => null,
x_attribute12 => null,
x_attribute13 => null,
x_attribute14 => null,
x_attribute15 => null,
x_last_update_date => null,
x_last_updated_by => l_last_updated_by,
x_creation_date => l_creation_date,
x_created_by => l_created_by,
x_last_update_login => l_last_update_login,
x_program_type => l_program_type,
x_payment_group_code => p_PmtPlan_rec.payment_group_code
);
x_loading_status := 'CN_DELETED';
ROLLBACK TO Delete_PmtPlan;
ROLLBACK TO Delete_PmtPlan;
ROLLBACK TO Delete_PmtPlan;
END Delete_PmtPlan;