The following lines contain the word 'select', 'insert', 'update' or 'delete':
select name, status, rev_class_hierarchy_id, set_of_books_id,
system_batch_size, transfer_batch_size, clawback_grace_days,
srp_batch_size, srp_rollup_flag, latest_processed_date, usage_flag,
salesrep_batch_size, cls_package_size, payables_flag, payroll_flag,
payables_ccid_level, income_planner_disclaimer,object_version_number
FROM cn_repositories
WHERE application_type = 'CN' and repository_id > 0;
PROCEDURE Update_Data
(p_api_version IN NUMBER ,
p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
p_commit IN VARCHAR2 := FND_API.G_FALSE ,
p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
p_name IN VARCHAR2,
p_rev_class_hierarchy_id IN NUMBER,
p_set_of_books_id IN NUMBER,
p_batch_size IN NUMBER,
p_transfer_batch_size IN NUMBER,
p_clawback_grace_days IN NUMBER,
p_transaction_batch_size IN NUMBER,
p_managerial_rollup IN VARCHAR2,
p_salesperson_batch_size IN NUMBER,
p_rule_batch_size IN NUMBER,
p_payables_flag IN VARCHAR2,
p_payroll_flag IN VARCHAR2,
p_payables_ccid_level IN VARCHAR2,
p_income_planner_disclaimer IN VARCHAR2,
p_object_version_number IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2 ,
x_msg_count OUT NOCOPY NUMBER ,
x_msg_data OUT NOCOPY VARCHAR2 ) IS
l_api_name CONSTANT VARCHAR2(30) := 'Update_Data';
select object_version_number
from cn_repositories
where application_type = 'CN'
and repository_id > 0
for update of repository_id nowait;
SAVEPOINT Update_Data;
fnd_message.set_name('CN', 'CN_RECORD_DELETED');
update cn_repositories
set name = p_name,
rev_class_hierarchy_id = p_rev_class_hierarchy_id,
set_of_books_id = p_set_of_books_id,
system_batch_size = p_batch_size,
transfer_batch_size = p_transfer_batch_size,
clawback_grace_days = p_clawback_grace_days,
srp_batch_size = p_transaction_batch_size,
srp_rollup_flag = p_managerial_rollup,
salesrep_batch_size = p_salesperson_batch_size,
cls_package_size = decode(p_rule_batch_size, 0, null,
p_rule_batch_size), -- 0 = null
payables_flag = p_payables_flag,
payroll_flag = p_payroll_flag,
payables_ccid_level = p_payables_ccid_level,
income_planner_disclaimer = p_income_planner_disclaimer,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id,
object_version_number = object_version_number + 1
where application_type = 'CN'
and repository_id > 0;
insert into cn_period_sets
( period_set_id,
period_set_name,
created_by,
creation_date )
select 0,
gl.period_set_name,
-1,
SYSDATE
from cn_repositories r,
gl_sets_of_books gl
where gl.set_of_books_id = r.set_of_books_id
and not exists
( select 1 from cn_period_sets where period_set_id = 0 );
insert into cn_period_types
( period_type_id,
period_type,
created_by,
creation_date )
select 0,
gl.accounted_period_type,
-1,
SYSDATE
from cn_repositories r,
gl_sets_of_books gl
where gl.set_of_books_id = r.set_of_books_id
and not exists
( select 1 from cn_period_types where period_type_id = 0 );
update cn_repositories
set period_set_id = 0 ,
period_type_id = 0
where set_of_books_id is not null;
update cn_period_types
set period_type = 'Period'
where period_type_id = -1000
and period_type = 'Month';
ROLLBACK TO Update_Data;
ROLLBACK TO Update_Data;
ROLLBACK TO Update_Data;
END Update_Data;