The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
rptg_grp_id,
name,
business_group_id,
rptg_prps_cd,
rpg_desc,
bnr_attribute_category,
bnr_attribute1,
bnr_attribute2,
bnr_attribute3,
bnr_attribute4,
bnr_attribute5,
bnr_attribute6,
bnr_attribute7,
bnr_attribute8,
bnr_attribute9,
bnr_attribute10,
bnr_attribute11,
bnr_attribute12,
bnr_attribute13,
bnr_attribute14,
bnr_attribute15,
bnr_attribute16,
bnr_attribute17,
bnr_attribute18,
bnr_attribute19,
bnr_attribute20,
bnr_attribute21,
bnr_attribute22,
bnr_attribute23,
bnr_attribute24,
bnr_attribute25,
bnr_attribute26,
bnr_attribute27,
bnr_attribute28,
bnr_attribute29,
bnr_attribute30,
function_code,
legislation_code,
object_version_number,
ordr_num --iRec
from ben_rptg_grp
where rptg_grp_id = p_rptg_grp_id;
select rptg_grp_id,
name,
business_group_id,
rptg_prps_cd,
rpg_desc,
bnr_attribute_category,
bnr_attribute1,
bnr_attribute2,
bnr_attribute3,
bnr_attribute4,
bnr_attribute5,
bnr_attribute6,
bnr_attribute7,
bnr_attribute8,
bnr_attribute9,
bnr_attribute10,
bnr_attribute11,
bnr_attribute12,
bnr_attribute13,
bnr_attribute14,
bnr_attribute15,
bnr_attribute16,
bnr_attribute17,
bnr_attribute18,
bnr_attribute19,
bnr_attribute20,
bnr_attribute21,
bnr_attribute22,
bnr_attribute23,
bnr_attribute24,
bnr_attribute25,
bnr_attribute26,
bnr_attribute27,
bnr_attribute28,
bnr_attribute29,
bnr_attribute30,
function_code,
legislation_code,
object_version_number,
ordr_num --iRec
from ben_rptg_grp
where rptg_grp_id = p_rptg_grp_id
for update nowait;
delete from BEN_RPTG_GRP_TL T
where not exists
(select NULL
from BEN_RPTG_GRP B
where B.RPTG_GRP_ID = T.RPTG_GRP_ID
);
update ben_rptg_grp_tl t set (
function_code,
name
) = (select
b.function_code,
b.name
from ben_rptg_grp_tl b
where b.RPTG_GRP_ID = t.RPTG_GRP_ID
and b.language = t.source_lang)
where (
t.RPTG_GRP_ID,
t.language
) in (select
subt.RPTG_GRP_ID,
subt.language
from ben_rptg_grp_tl subb, ben_rptg_grp_tl subt
where subb.RPTG_GRP_ID = subt.RPTG_GRP_ID
and subb.language = subt.source_lang
and (subb.name <> subt.name
or subb.function_code <> subt.function_code
));
insert into ben_rptg_grp_tl (
RPTG_GRP_ID,
function_code,
name,
language,
source_lang,
last_update_date,
last_updated_by,
last_update_login,
created_by,
creation_date
) select
b.RPTG_GRP_ID,
b.function_code,
b.name,
l.language_code,
b.source_lang,
b.last_update_date,
b.last_updated_by,
b.last_update_login,
b.created_by,
b.creation_date
from ben_rptg_grp_tl b, fnd_languages l
where l.installed_flag in ('I', 'B')
and b.language = userenv('LANG')
and not exists
(select null
from ben_rptg_grp_tl t
where t.rptg_grp_id = b.rptg_grp_id
and t.language = l.language_code);