The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT fou.oracle_username
INTO l_schema_name
FROM fnd_oracle_userid fou
,fnd_product_installations fpi
,fnd_application fap
WHERE fou.oracle_id = fpi.oracle_id
AND fpi.application_id = fap.application_id
AND fap.application_short_name = p_app_short_name;
SELECT fou.oracle_username
INTO l_schema_name
FROM fnd_oracle_userid fou
WHERE fou.oracle_id = p_oracle_id;
SELECT 1
INTO policy_exists
FROM all_sa_users
WHERE policy_name=''HR_ENTERPRISE_POLICY''
AND user_name = ''C::ENT'';
add_body_line('SELECT to_data_label(''HR_ENTERPRISE_POLICY'',''C::ENT'') INTO dummy FROM dual;');
add_body_line('SELECT to_data_label(''HR_ENTERPRISE_POLICY'',''C::GLOBAL'') INTO dummy FROM dual;');
add_header_line('-- p_person_id => id of the selected person');
add_header_line('-- p_person_id => id of the selected person');
add_header_line('-- p_business_group_id => id of the selected business group.');
add_header_line('-- p_business_group_id => id of the selected business group.');
add_header_line(' -- p_business_group_id => id of the selected business group.');
add_header_line('-- p_business_group_id => id of the selected business group.');
add_header_line(' -- Updates TL table');
add_body_line(' SELECT security_group_key');
add_body_line(' SELECT enterprise_label');
add_body_line('-- p_business_group_id => id of the selected business group.');
add_body_line(' SELECT enterprise_label');
add_body_line(' SELECT description, meaning');
add_body_line(' SELECT enterprise_label');
add_body_line(' SELECT enterprise_label');
add_body_line('PROCEDURE insert_hr_name_formats ( p_enterprise_code IN varchar2)');
add_body_line(' SELECT format_name');
add_body_line(' -- And we want smooth insertions without any exceptions due to colliding');
add_body_line(' select max(name_format_id)');
add_body_line(' select hr_name_formats_s.nextval into next_id from dual;');
add_body_line(' select hr_name_formats_s.nextval into next_id from dual;');
add_body_line('execute immediate ''insert into hr_name_formats (name_format_id');
add_body_line(' -- This procedure called from PerEnterprisesTlEOImpl post insert. ');
add_body_line(' select ''Y''');
add_body_line(' select max(group_num) + 1');
add_body_line(' select to_data_label(''HR_ENTERPRISE_POLICY'', l_enterprise_label)');
add_body_line(' select ''Y'' ');
add_body_line(' update per_enterprises');
add_body_line(' insert_hr_name_formats(l_enterprise_label);');
add_body_line(' select label_to_char(HR_ENTERPRISE) into l_enterprise_label ');
add_body_line(' select enterprise_label into l_label1 ');
add_body_line(' update per_enterprises_tl');
add_body_line(' select ent.enterprise_short_code into l_ent_short_code');
add_body_line(' select business_group_id into l_bg_id');
add_body_line('select sa_session.sa_user_name(''HR_ENTERPRISE_POLICY'') into user_name from dual;');
add_body_line(' SELECT ''Y'' ');
add_body_line(' ''SELECT LABEL_TO_CHAR(HR_ENTERPRISE) ENT_LABEL, BUSINESS_GROUP_ID '' ||');
add_body_line(' SELECT enabled_flag');
add_body_line(' SELECT enterprise_label');
add_body_line(' SELECT count(*)');
add_body_line('-- p_business_group_id => id of the selected business group.');
add_body_line(' SELECT ''Y''');
add_body_line('-- p_person_id => id of the selected person');
add_body_line(' ''SELECT LABEL_TO_CHAR(HR_ENTERPRISE) ENT_LABEL, BUSINESS_GROUP_ID '' ||');
add_body_line(' SELECT business_group_id ');
add_body_line(' SELECT organization_id');
add_body_line(' -- Get OrganizationId FROM LoginPersonId AND SelectedBusinessGroupId');
add_body_line(' -- p_person_id => id of the selected person');
add_body_line(' ''SELECT LABEL_TO_CHAR(HR_ENTERPRISE) ENT_LABEL '' ||');
add_body_line(' SELECT organization_id');
add_body_line('-- p_business_group_id => id of the selected business group.');
add_body_line(' SELECT organization_id');
add_body_line(' SELECT description ');
add_body_line(' SELECT security_group_id ');
add_body_line(' SELECT business_group_id');
add_body_line(' SELECT security_group_id');
add_body_line(' SELECT business_group_id');
add_body_line('-- Updates TL table');
add_body_line(' SELECT pet.enterprise_id');
add_body_line(' SELECT l.language_code');
add_body_line(' AND NOT EXISTS (SELECT NULL');
add_body_line(' DELETE FROM per_enterprises_tl t');
add_body_line(' ( SELECT NULL');
add_body_line(' UPDATE per_enterprises_tl t');
add_body_line(' ( SELECT b.enterprise_name,');
add_body_line(' ( SELECT subt.enterprise_id,');
add_body_line(' INSERT INTO per_enterprises_tl');
add_body_line(' ,last_updated_by');
add_body_line(' ,last_update_date');
add_body_line(' SELECT ''Y''');
add_body_line(' SELECT substrb(security_group_name, 1, 80), security_group_id');
add_body_line(' SELECT substrb(hou.name,1,80)');
add_body_line(' EXECUTE IMMEDIATE ''INSERT INTO per_ent_security_groups ');
add_body_line(' SELECT business_group_id');
add_body_line(' SELECT 1');
add_body_line('-- Select the long name and the company label for this enterprise id');
add_body_line(' SELECT substr(enterprise_short_code, 1, 80)');
add_body_line(' ''INSERT INTO per_number_generation_controls ');
add_body_line(' ''INSERT INTO per_number_generation_controls ');
add_body_line(' ''INSERT INTO per_number_generation_controls ');
add_body_line(' EXECUTE IMMEDIATE ''UPDATE ''||init_table_name||'' ');
add_body_line(' EXECUTE IMMEDIATE ''UPDATE '' || init_child_tables(t_index).table_name ||');
add_body_line(' '' (SELECT '' || init_child_tables(t_index).master_key_name || ');
add_body_line('-- In model 1 update entries in the hr_all_organization_units for this enterprise');
add_body_line('EXECUTE IMMEDIATE ''UPDATE hr_all_organization_units');
add_body_line(' UPDATE hr_organization_information');
add_body_line('-- In model 1 update entries in the hr_organization_information for this enterprise');
add_body_line('EXECUTE IMMEDIATE ''UPDATE hr_organization_information');
add_body_line('-- In model 1 update entries in the hr_all_organization_units_tl for this enterprise');
add_body_line(' EXECUTE IMMEDIATE ''UPDATE hr_all_organization_units_tl');
add_body_line(' ,''No organization selected :'');');
add_body_line(' ,''No organization selected : '');');
add_body_line(' select fou.oracle_username');
add_body_line(' select count(*) ');
add_body_line(' SELECT count(*) ');
add_body_line(' WHERE user_table_id = (SELECT user_table_id');
add_body_line(' select owner, table_name ');
add_body_line(' from (select owner, ');
add_body_line(' select row_low_range_or_name, ');
add_body_line(' from (select f.row_low_range_or_name');
add_body_line(' predicate_table(22) :=''AME_TEMP_INSERTIONS'';');
add_body_line(' seeddata_table(111) := ''PAY_EVENT_UPDATES'';');
add_body_line('-- Based on the install mode selectively enable policy on tables ');
add_body_line(' l_table_options := ''READ_CONTROL, UPDATE_CONTROL, DELETE_CONTROL, LABEL_DEFAULT, HIDE'';');
add_body_line(' execute immediate ''UPDATE '' || l_schema_name || ''.'' || l_table_name ||');
add_body_line(' SELECT status');
add_body_line(' execute immediate ''UPDATE '' || l_schema_name || ''.'' || l_table_name ||');
add_body_line(' -- Update null to C::ENT');