The following lines contain the word 'select', 'insert', 'update' or 'delete':
select object_name,object_type
bulk collect into obs_object_name, obs_object_type
from AD_OBSOLETE_OBJECTS
where APPLICATION_ID = x_appl_id
and object_type not in ('TABLE', 'INDEX')
and (UPPER(dropped) = 'N' or upper(dropped) is null);
l_upd_statement := 'update AD_OBSOLETE_OBJECTS set DROPPED = '
||'''Y'''||' where APPLICATION_ID = '|| x_appl_id
||' and OBJECT_NAME = '||''''||
obs_object_name(n)||''''||' and OBJECT_TYPE = '||
''''||obs_object_type(n)||'''';
select object_name,object_type
bulk collect into obs_object_name, obs_object_type
from AD_OBSOLETE_OBJECTS
where APPLICATION_ID = x_appl_id
and object_type in ('TABLE', 'INDEX')
and (UPPER(dropped) = 'N' or upper(dropped) is null);
l_upd_statement := 'update AD_OBSOLETE_OBJECTS set DROPPED = '
||'''Y'''||' where APPLICATION_ID = '|| x_appl_id
||' and OBJECT_NAME = '||''''||
obs_object_name(n)||''''||' and OBJECT_TYPE = '||
''''||obs_object_type(n)||'''';
l_insert_statement varchar2(500);
select synonym_name
bulk collect into ds_object_name
from dba_synonyms
where TABLE_OWNER = l_schema_name
and synonym_name not in
(select object_name
from AD_OBSOLETE_OBJECTS
where APPLICATION_ID = x_appl_id
and OBJECT_TYPE = 'SYNONYM'
and (UPPER(dropped) = 'N' or upper(dropped) is null));
l_insert_statement := 'insert into AD_OBSOLETE_OBJECTS '||
'(APPLICATION_ID, OBJECT_NAME, '||
'OBJECT_TYPE, LAST_UPDATED_BY, '||
' CREATED_BY, CREATION_DATE, '||
'LAST_UPDATE_DATE, DROPPED) values ('||x_appl_id||
', '||''''||ds_object_name(n)||''''||', '||''''||
'SYNONYM'||''''||', '||'1, 1, '||
'sysdate, sysdate, '||''''||'Y'||''''||')';
execute immediate l_insert_statement;
select object_name,object_type
bulk collect into obs_object_name, obs_object_type
from DBA_OBJECTS DO, FND_APPLICATION fa
where fa.APPLICATION_ID = x_appl_id
--and fa.APPLICATION_SHORT_NAME = do.OWNER
and do.OWNER = decode (fa.APPLICATION_SHORT_NAME,
'SQLGL', 'GL',
'SQLAP', 'AP',
'SQLSO', 'SO',
'OFA', 'FA',
fa.APPLICATION_SHORT_NAME)
and do.OBJECT_TYPE <> 'LOB';
l_insert_statement := 'insert into AD_OBSOLETE_OBJECTS '||
'(APPLICATION_ID, OBJECT_NAME, '||
'OBJECT_TYPE, LAST_UPDATED_BY, '||
' CREATED_BY, CREATION_DATE, '||
'LAST_UPDATE_DATE, DROPPED) values ('||x_appl_id||
', '||''''||obs_object_name(n)||''''||', '||''''||
obs_object_type(n)||''''||', '||'1, 1, '||
'sysdate, sysdate, '||''''||'Y'||''''||')';
execute immediate l_insert_statement;
delete from FND_ORACLE_USERID
where oracle_id =
( select oracle_id from FND_PRODUCT_INSTALLATIONS where application_id = x_appl_id)
and oracle_username = l_schema_name;
delete from FND_PRODUCT_INSTALLATIONS where application_id = x_appl_id;
delete from FND_PRODUCT_DEPENDENCIES where required_application_id = x_appl_id;
SELECT oracle_username
INTO l_apps_oracle_name
FROM fnd_oracle_userid
WHERE oracle_id BETWEEN 900 and 999
and read_only_flag = 'U';
select aoo.object_name, aoo.object_type
bulk collect into obs_object_name, obs_object_type
from AD_OBSOLETE_OBJECTS aoo
where aoo.APPLICATION_ID = x_appl_id
and (UPPER(dropped) = 'N' or upper(dropped) is null)
and aoo.object_type <> 'SYNONYM'
and exists
(select do.object_name from dba_objects do
where do.owner = l_apps_oracle_name
and do.OBJECT_NAME = aoo.OBJECT_NAME
and do.object_type = aoo.object_type);
l_upd_statement := 'update AD_OBSOLETE_OBJECTS set DROPPED = '
||'''Y'''||' where OBJECT_NAME = '||''''||
obs_object_name(n)||''''||' and OBJECT_TYPE = '||
''''||obs_object_type(n)||''''||
' and APPLICATION_ID = '|| x_appl_id;
select APPLICATION_SHORT_NAME
into l_app_short_name
from FND_APPLICATION
where APPLICATION_ID = x_appl_id;