The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
activity_id
,name
,description
,language
,source_lang
from ota_activity_definitions_tl
where activity_id = p_activity_id
and language = p_language;
select
activity_id
,name
,description
,language
,source_lang
from ota_activity_definitions_tl
where activity_id = p_activity_id
and language = p_language
for update nowait;
delete from OTA_ACTIVITY_DEFINITIONS_TL T
where not exists
(select NULL
from OTA_ACTIVITY_DEFINITIONS B
where B.ACTIVITY_ID = T.ACTIVITY_ID
);
update OTA_ACTIVITY_DEFINITIONS_TL T set (
NAME,
DESCRIPTION
) = (select
B.NAME,
B.DESCRIPTION
from OTA_ACTIVITY_DEFINITIONS_TL B
where B.ACTIVITY_ID = T.ACTIVITY_ID
and B.LANGUAGE = T.SOURCE_LANG)
where (
T.ACTIVITY_ID,
T.LANGUAGE
) in (select
SUBT.ACTIVITY_ID,
SUBT.LANGUAGE
from OTA_ACTIVITY_DEFINITIONS_TL SUBB, OTA_ACTIVITY_DEFINITIONS_TL SUBT
where SUBB.ACTIVITY_ID = SUBT.ACTIVITY_ID
and SUBB.LANGUAGE = SUBT.SOURCE_LANG
and (SUBB.NAME <> SUBT.NAME
or SUBB.DESCRIPTION <> SUBT.DESCRIPTION
or (SUBB.DESCRIPTION is null and SUBT.DESCRIPTION is not null)
or (SUBB.DESCRIPTION is not null and SUBT.DESCRIPTION is null)
));
insert into OTA_ACTIVITY_DEFINITIONS_TL (
ACTIVITY_ID,
NAME,
DESCRIPTION,
CREATED_BY,
CREATION_DATE,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_LOGIN,
LANGUAGE,
SOURCE_LANG
) select
B.ACTIVITY_ID,
B.NAME,
B.DESCRIPTION,
B.CREATED_BY,
B.CREATION_DATE,
B.LAST_UPDATE_DATE,
B.LAST_UPDATED_BY,
B.LAST_UPDATE_LOGIN,
L.LANGUAGE_CODE,
B.SOURCE_LANG
from OTA_ACTIVITY_DEFINITIONS_TL B, FND_LANGUAGES L
where L.INSTALLED_FLAG in ('I', 'B')
and B.LANGUAGE = userenv('LANG')
and not exists
(select NULL
from OTA_ACTIVITY_DEFINITIONS_TL T
where T.ACTIVITY_ID = B.ACTIVITY_ID
and T.LANGUAGE = L.LANGUAGE_CODE);