The following lines contain the word 'select', 'insert', 'update' or 'delete':
sqltxt VARCHAR2(9999); -- SQL select statement
JTF_DIAGNOSTIC_COREAPI.insert_style_sheet;
select 1 into l_org_exists
from mtl_parameters
where organization_id=l_org_id;
sqltxt :=' select eec.change_notice "ECO Number", '||
' mp.organization_code "Organization Code", '||
' ecsvl.status_name "Current Status Name", '||
' eec.status_type "Current Status Type", '||
' eec.change_id "Change Id", '||
' eec.organization_id "Organization Id" '||
' from eng_engineering_changes eec, mtl_parameters mp '||
' ,eng_change_statuses_vl ecsvl '||
' where eec.organization_id = mp.organization_id '||
' and eec.APPROVAL_STATUS_TYPE <> 4 '||
' and eec.status_type not in (5,6) '||
' and eec.status_type = ecsvl.status_code(+) '||
' and not exists (select 1 from eng_revised_items eri '||
' where eri.change_notice = eec.change_notice '||
' and eri.organization_id = eec.organization_id '||
' and eri.status_type not in (5,6)) '||
' and exists (select 1 from eng_revised_items eri1 '||
' where eri1.change_notice = eec.change_notice '||
' and eri1.organization_id = eec.organization_id '||
' and eri1.status_type = 6) ';