The following lines contain the word 'select', 'insert', 'update' or 'delete':
procedure INSERT_ROW(
x_billing_source_id IN NUMBER ,
x_name IN VARCHAR2 ,
x_description IN VARCHAR2 ,
x_procedure_code IN NUMBER,
x_billing_source_code IN VARCHAR2 ,
x_creation_date IN DATE,
x_created_by IN NUMBER,
x_last_update_date IN DATE,
x_last_updated_by IN NUMBER ,
x_last_update_login IN NUMBER
) AS
BEGIN
INSERT INTO mtl_billing_sources_b
( billing_source_id ,
procedure_code ,
billing_source_code ,
creation_date ,
created_by ,
last_update_date ,
last_updated_by ,
last_update_login
)
VALUES
( x_billing_source_id ,
x_procedure_code ,
x_billing_source_code ,
x_creation_date ,
x_created_by ,
x_last_update_date ,
x_last_updated_by ,
x_last_update_login
);
INSERT INTO mtl_billing_sources_tl
( billing_source_id ,
name ,
description ,
creation_date ,
created_by ,
last_update_date ,
last_updated_by ,
last_update_login ,
LANGUAGE ,
source_lang
)
SELECT
x_billing_source_id ,
x_name ,
x_description ,
x_creation_date ,
x_created_by ,
x_last_update_date ,
x_last_updated_by ,
x_last_update_login ,
L.LANGUAGE_CODE,
userenv('LANG')
from FND_LANGUAGES L
where L.INSTALLED_FLAG in ('I', 'B')
and not exists
(select NULL
from mtl_billing_sources_tl T
where T.billing_source_id = x_billing_source_id
and T.LANGUAGE = L.LANGUAGE_CODE);
END INSERT_ROW;
procedure UPDATE_ROW(
x_billing_source_id IN NUMBER ,
x_name IN VARCHAR2 ,
x_description IN VARCHAR2 ,
x_procedure_code IN NUMBER,
x_billing_source_code IN VARCHAR2,
x_creation_date IN DATE,
x_created_by IN NUMBER,
x_last_update_date IN DATE,
x_last_updated_by IN NUMBER ,
x_last_update_login IN NUMBER
) AS
CURSOR cur_sources IS SELECT 1 FROM mtl_billing_sources_b
WHERE billing_Source_id = x_billing_source_id;
update mtl_billing_sources_b set
procedure_code = x_procedure_code,
billing_source_code = x_billing_source_code ,
last_update_date = x_last_update_date,
last_updated_by = x_last_updated_by,
last_update_login = x_last_update_login
where billing_source_id = x_billing_source_id;
update mtl_billing_sources_tl set
name = x_name,
description = x_description,
last_update_date = x_last_update_date,
last_updated_by = x_last_updated_by,
last_update_login = x_last_update_login,
SOURCE_LANG = userenv('LANG')
where billing_source_id = x_billing_source_id
and userenv('LANG') in (LANGUAGE, SOURCE_LANG);
END UPDATE_ROW;
procedure DELETE_ROW (
x_billing_source_id in NUMBER
) is
BEGIN
delete from mtl_billing_sources_tl
where billing_source_id = x_billing_source_id;
delete from mtl_billing_sources_b
where billing_source_id = x_billing_source_id;
end DELETE_ROW;
x_last_update_date IN DATE,
x_last_updated_by IN NUMBER ,
x_last_update_login IN NUMBER
) is
cursor c is select
billing_source_id ,
procedure_code ,
billing_source_code ,
creation_date ,
created_by ,
last_update_date ,
last_updated_by ,
last_update_login
from mtl_billing_sources_b
where billing_source_id = x_billing_source_id
for update of billing_source_id nowait;
cursor c1 is select
name,
DESCRIPTION,
decode(LANGUAGE, userenv('LANG'), 'Y', 'N') BASELANG
from mtl_billing_sources_tl
where billing_source_id = x_billing_source_id
and userenv('LANG') in (LANGUAGE, SOURCE_LANG)
for update of billing_source_id nowait;
fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
delete from mtl_billing_sources_tl T
where not exists
(select NULL
from mtl_billing_sources_b B
where B.billing_source_id = T.billing_source_id
);
update mtl_billing_sources_tl T
set (
name,
description
) = (select
B.name,
B.description
from mtl_billing_sources_tl B
where B.billing_source_id = T.billing_source_id
and B.language = T.source_lang)
where (
T.billing_source_id,
T.language
)
in (select
blsrct.billing_source_id,
blsrct.language
from mtl_billing_sources_tl blsrcb, mtl_billing_sources_tl blsrct
where blsrcb.billing_source_id = blsrct.billing_source_id
and blsrcb.language = blsrct.source_lang
and (blsrcb.name <> blsrct.name
or blsrcb.description <> blsrct.description
or (blsrcb.description is null and blsrct.description is not null)
or (blsrcb.description is not null and blsrct.description is null)
)
);
insert into mtl_billing_sources_tl
(
billing_source_id,
name,
description,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
language,
source_lang
) select /*+ ORDERED */
B.billing_source_id,
B.name,
B.description,
B.creation_date,
B.created_by,
B.last_update_date,
B.last_updated_by,
B.last_update_login,
L.language_code,
B.source_lang
from mtl_billing_sources_tl B, fnd_languages L
where L.installed_flag in ('I', 'B')
and B.language = userenv('LANG')
and not exists
(select NULL
from mtl_billing_sources_tl T
where T.billing_source_id = B.billing_source_id
and T.language = L.language_code);