The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
activity_version_id
,language
,source_lang
,version_name
,description
,intended_audience
,objectives
,keywords
from ota_activity_versions_tl
where activity_version_id = p_activity_version_id
and language = p_language;
select
activity_version_id
,language
,source_lang
,version_name
,description
,intended_audience
,objectives
,keywords
from ota_activity_versions_tl
where activity_version_id = p_activity_version_id
and language = p_language
for update nowait;
delete from OTA_ACTIVITY_VERSIONS_TL T
where not exists
(select NULL
from OTA_ACTIVITY_VERSIONS B
where B.ACTIVITY_VERSION_ID = T.ACTIVITY_VERSION_ID
);
update OTA_ACTIVITY_VERSIONS_TL T set (
VERSION_NAME,
DESCRIPTION,
INTENDED_AUDIENCE,
OBJECTIVES,
KEYWORDS
) = (select
B.VERSION_NAME,
B.DESCRIPTION,
B.INTENDED_AUDIENCE,
B.OBJECTIVES,
B.KEYWORDS
from OTA_ACTIVITY_VERSIONS_TL B
where B.ACTIVITY_VERSION_ID = T.ACTIVITY_VERSION_ID
and B.LANGUAGE = T.SOURCE_LANG)
where (
T.ACTIVITY_VERSION_ID,
T.LANGUAGE
) in (select
SUBT.ACTIVITY_VERSION_ID,
SUBT.LANGUAGE
from OTA_ACTIVITY_VERSIONS_TL SUBB, OTA_ACTIVITY_VERSIONS_TL SUBT
where SUBB.ACTIVITY_VERSION_ID = SUBT.ACTIVITY_VERSION_ID
and SUBB.LANGUAGE = SUBT.SOURCE_LANG
and (SUBB.VERSION_NAME <> SUBT.VERSION_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)
or SUBB.INTENDED_AUDIENCE <> SUBT.INTENDED_AUDIENCE
or (SUBB.INTENDED_AUDIENCE is null and SUBT.INTENDED_AUDIENCE is not null)
or (SUBB.INTENDED_AUDIENCE is not null and SUBT.INTENDED_AUDIENCE is null)
or SUBB.OBJECTIVES <> SUBT.OBJECTIVES
or (SUBB.OBJECTIVES is null and SUBT.OBJECTIVES is not null)
or (SUBB.OBJECTIVES is not null and SUBT.OBJECTIVES is null)
or SUBB.KEYWORDS <> SUBT.KEYWORDS
or (SUBB.KEYWORDS is null and SUBT.KEYWORDS is not null)
or (SUBB.KEYWORDS is not null and SUBT.KEYWORDS is null)
));
insert into OTA_ACTIVITY_VERSIONS_TL (
ACTIVITY_VERSION_ID,
VERSION_NAME,
DESCRIPTION,
INTENDED_AUDIENCE,
OBJECTIVES,
KEYWORDS,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_LOGIN,
CREATED_BY,
CREATION_DATE,
LANGUAGE,
SOURCE_LANG
) select
B.ACTIVITY_VERSION_ID,
B.VERSION_NAME,
B.DESCRIPTION,
B.INTENDED_AUDIENCE,
B.OBJECTIVES,
B.KEYWORDS,
B.LAST_UPDATE_DATE,
B.LAST_UPDATED_BY,
B.LAST_UPDATE_LOGIN,
B.CREATED_BY,
B.CREATION_DATE,
L.LANGUAGE_CODE,
B.SOURCE_LANG
from OTA_ACTIVITY_VERSIONS_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_VERSIONS_TL T
where T.ACTIVITY_VERSION_ID = B.ACTIVITY_VERSION_ID
and T.LANGUAGE = L.LANGUAGE_CODE);