The following lines contain the word 'select', 'insert', 'update' or 'delete':
select fsav.application_column_name,
fifst.concatenated_segment_delimiter delimeter
from fnd_segment_attribute_values fsav,
fnd_id_flex_segments fifs,
per_job_definitions pjd,
per_jobs pj,
fnd_id_flex_structures fifst
where pj.job_id = p_job_id
and pj.job_definition_id = p_job_definition_id
and pjd.job_definition_id = pj.job_definition_id
and fsav.id_flex_code = 'JOB'
and fsav.id_flex_num = pjd.id_flex_num
and fsav.attribute_value = 'Y'
and fsav.segment_attribute_type = 'FR_REPORTING'
and fifs.id_flex_code = fsav.id_flex_code
and fifs.id_flex_num = fsav.id_flex_num
and fifs.application_id = fsav.application_id
and fifs.application_column_name = fsav.application_column_name
and fifst.id_flex_code = fsav.id_flex_code
and fifst.id_flex_num = pjd.id_flex_num
and fifst.application_id = fsav.application_id
order by fifs.segment_num;
l_select varchar2(50);
l_select := NULL;
fetch get_segments into l_select, l_delimeter;
'nvl(' || l_select ||', ''_NULL_'')'||
' || '''|| l_delimeter||''' ||';
open csr_segment_values for 'select '||l_column_name||
' from per_job_definitions
where job_definition_id = '||p_job_definition_id;