The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT DISTINCT org_information4 template_code
FROM hr_organization_information
WHERE org_information_context = 'HR_SELF_SERVICE_BG_PREFERENCE'
AND organization_id = p_business_group_id
AND org_information1 = 'PAYSLIP'
AND org_information3 = 'Y';
SELECT legislation_code
FROM per_business_groups
WHERE business_group_id = p_business_group_id;
SELECT report_group_id
FROM pay_report_groups
WHERE short_name = 'PAYSLIP_REPORT'
AND report_group_name = 'Generic Payslip Report';
SELECT report_category_id
FROM pay_report_categories
WHERE category_name = c_leg_code||' Payslip Report'
AND short_name = c_leg_code||'_PAYSLIP_REPORT'
AND business_group_id = p_business_group_id;
SELECT report_variable_id
,report_definition_id
FROM pay_report_variables
WHERE business_group_id = p_business_group_id;
INSERT INTO pay_report_categories
( REPORT_CATEGORY_ID,
REPORT_GROUP_ID,
CATEGORY_NAME,
--LEGISLATION_CODE,
SHORT_NAME,
BUSINESS_GROUP_ID)
SELECT
PAY_REPORT_CATEGORIES_S.nextval,
report_group_id,
l_legislation_code||' Payslip Report',
--'DK',
l_legislation_code||'_PAYSLIP_REPORT',
p_business_group_id
FROM pay_report_groups prg
WHERE short_name = 'PAYSLIP_REPORT'
AND report_group_name = 'Generic Payslip Report'
AND NOT EXISTS
(SELECT NULL
FROM pay_report_categories
WHERE report_group_id = prg.report_group_id
AND short_name = l_legislation_code||'_PAYSLIP_REPORT'
AND category_name = l_legislation_code||' Payslip Report');
DELETE FROM pay_report_variables
WHERE business_group_id = p_business_group_id
AND report_definition_id IN ( SELECT report_definition_id
from pay_report_definitions
where report_name = 'Generic Payslip Report (pdf)' );
DELETE FROM pay_report_category_components
WHERE business_group_id = p_business_group_id
AND report_category_id IN ( SELECT report_category_id
FROM pay_report_categories
WHERE short_name = l_legislation_code||'_PAYSLIP_REPORT');
INSERT INTO pay_report_variables
( REPORT_VARIABLE_ID,
REPORT_DEFINITION_ID,
DEFINITION_TYPE,
NAME,
VALUE,
--LEGISLATION_CODE,
BUSINESS_GROUP_ID)
SELECT
PAY_REPORT_VARIABLES_S.nextval,
report_definition_id,
'SS',
l_legislation_code||' Payslip Template',
csr_template_code.template_code,
--'DK',
p_business_group_id
FROM pay_report_definitions prd
WHERE report_name = 'Generic Payslip Report (pdf)'
AND report_group_id = l_report_group_id
AND NOT EXISTS
(SELECT NULL
FROM pay_report_variables
WHERE value = csr_template_code.template_code
AND name = l_legislation_code||' Payslip Template'
AND report_definition_id = prd.report_definition_id);
INSERT INTO pay_report_category_components
(REPORT_CATEGORY_COMP_ID,
REPORT_CATEGORY_ID,
REPORT_DEFINITION_ID,
STYLE_SHEET_VARIABLE_ID,
--LEGISLATION_CODE,
BUSINESS_GROUP_ID)
SELECT
PAY_REPORT_CATEGORY_COMP_S.nextval,
report_category_id,
csr_report_varables.report_definition_id,
csr_report_varables.report_variable_id,
--'DK',
p_business_group_id
FROM pay_report_categories prc
WHERE short_name = l_legislation_code||'_PAYSLIP_REPORT'
AND category_name = l_legislation_code||' Payslip Report'
AND report_group_id = l_report_group_id
AND NOT EXISTS
(SELECT NULL
FROM pay_report_category_components
WHERE report_category_id = prc.report_category_id
AND report_definition_id = csr_report_varables.report_definition_id
AND style_sheet_variable_id = csr_report_varables.report_variable_id);