The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
template_id,
template_name,
language,
source_lang
from pqh_templates_tl
where template_id = p_template_id
and language = p_language;
select template_id,
template_name,
language,
source_lang
from pqh_templates_tl
where template_id = p_template_id
and language = p_language
for update nowait;
delete from PQH_TEMPLATES_TL T
where not exists
(select NULL
from PQH_TEMPLATES B
where B.TEMPLATE_ID = T.TEMPLATE_ID
);
update PQH_TEMPLATES_TL T set (
TEMPLATE_NAME
) = (select
B.TEMPLATE_NAME
from PQH_TEMPLATES_TL B
where B.TEMPLATE_ID = T.TEMPLATE_ID
and B.LANGUAGE = T.SOURCE_LANG)
where (
T.TEMPLATE_ID,
T.LANGUAGE
) in (select
SUBT.TEMPLATE_ID,
SUBT.LANGUAGE
from PQH_TEMPLATES_TL SUBB, PQH_TEMPLATES_TL SUBT
where SUBB.TEMPLATE_ID = SUBT.TEMPLATE_ID
and SUBB.LANGUAGE = SUBT.SOURCE_LANG
and (SUBB.TEMPLATE_NAME <> SUBT.TEMPLATE_NAME
));
insert into PQH_TEMPLATES_TL (
TEMPLATE_ID,
TEMPLATE_NAME,
LAST_UPDATE_DATE,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
LAST_UPDATED_BY,
LANGUAGE,
SOURCE_LANG
) select
B.TEMPLATE_ID,
B.TEMPLATE_NAME,
B.LAST_UPDATE_DATE,
B.CREATION_DATE,
B.CREATED_BY,
B.LAST_UPDATE_LOGIN,
B.LAST_UPDATED_BY,
L.LANGUAGE_CODE,
B.SOURCE_LANG
from PQH_TEMPLATES_TL B, FND_LANGUAGES L
where L.INSTALLED_FLAG in ('I', 'B')
and B.LANGUAGE = userenv('LANG')
and not exists
(select NULL
from PQH_TEMPLATES_TL T
where T.TEMPLATE_ID = B.TEMPLATE_ID
and T.LANGUAGE = L.LANGUAGE_CODE);