The following lines contain the word 'select', 'insert', 'update' or 'delete':
procedure update_mv_log_sql(p_base_object_name in varchar2,
p_base_object_type in varchar2,
p_snapshot_log_sql in CLOB) is
begin
update bis_obj_properties set snapshot_log_sql= p_snapshot_log_sql
where object_name=p_base_object_name
and object_type=p_base_object_type;
procedure update_mv_log_status(p_base_object_name in varchar2,
p_base_object_type in varchar2,
p_status in varchar2) is
begin
update bis_obj_properties
set mv_log_status=p_status,
status_time_stamp=sysdate
where object_name=p_base_object_name
and object_type=p_base_object_type;
SELECT created mv_creation_date_dd
FROM all_objects
WHERE owner=p_base_object_schema
and object_name = p_base_object_name
and object_type=decode(p_base_object_type,'TABLE','TABLE','MV','MATERIALIZED VIEW') ;
SELECT af.filename filename
, MAX(acf.creation_date) file_creation_date
FROM ad_check_files acf
, ad_files af
WHERE af.file_id = acf.file_id
AND (
filename =p_base_object_name || '.xdf'
OR filename = LOWER(p_base_object_name) || '.xdf'
)
and acf.creation_date>
(select STATUS_TIME_STAMP
from bis_obj_properties
where object_name=upper(p_base_object_name)
and object_type=p_base_object_type)
GROUP BY af.filename;
SELECT af.filename filename
, MAX(acf.creation_date) file_creation_date
FROM ad_check_files acf
, ad_files af
WHERE af.file_id = acf.file_id
AND (
filename =upper(p_base_object_name)||'_MLOG' || '.xdf'
OR filename = LOWER(p_base_object_name)||'_mlog'|| '.xdf'
)
and acf.creation_date>
(select STATUS_TIME_STAMP
from bis_obj_properties
where object_name=upper(p_base_object_name)
and object_type=p_base_object_type)
GROUP BY af.filename;
select OBJECT_CREATION_DATE
from bis_obj_properties
where object_name=p_base_object_name
and object_type=p_base_object_type;
procedure update_obj_creation_date(p_base_object_name in varchar2,p_base_object_type in varchar2,p_base_object_schema in varchar2) is
begin
update bis_obj_properties
set OBJECT_CREATION_DATE=get_mv_creation_date_dd(p_base_object_name,p_base_object_type,p_base_object_schema)
where object_type=p_base_object_type
and object_name=p_base_object_name;
SELECT log_table
FROM All_SNAPSHOT_LOGS LOG
WHERE log.master = p_mview_name
AND log_owner = p_object_schema;
l_stmt := 'SELECT INDEX_NAME, OWNER, TO_CHAR(sys.ad_dbms_metadata.GET_DDL(''INDEX'',INDEX_NAME,OWNER)) FROM '||
'(select index_name , OWNER from all_indexes where table_name = :1 and owner = :2)';
update bis_obj_indexes set INDEX_SQL = l_ddl, LAST_UPDATE_DATE = sysdate, LAST_UPDATED_BY = FND_GLOBAL.User_id, LAST_UPDATE_LOGIN = fnd_global.LOGIN_ID where OBJECT_NAME=p_mv_log_name and OBJECT_TYPE='MVLOG' and INDEX_NAME=l_index_name;
INSERT INTO bis_obj_indexes( OBJECT_NAME, OBJECT_TYPE, INDEX_NAME, INDEX_SQL, CREATION_DATE, CREATED_BY, LAST_UPDATE_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN)
values(p_mv_log_name, 'MVLOG', l_index_name, l_ddl, sysdate, FND_GLOBAL.User_id, sysdate, FND_GLOBAL.User_id, fnd_global.LOGIN_ID);
select snapshot_log_sql,mv_log_status
from bis_obj_properties
where object_name=p_base_object_name
and object_type=P_base_object_type;
select 'Y'
from dual
where exists(
select log_table
from all_snapshot_logs
where master=p_base_object_name
and log_owner=p_base_object_schema);
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'NOLOG') ;
WRITELOG('MV log definition for this object in RSG is also null. Only update status to ''NOLOG''');
update_mv_log_sql(p_base_object_name ,
p_base_object_type,
l_snapshot_log_sql_handle);
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'NOLOG') ;
DELETE bis_obj_indexes where OBJECT_NAME=l_mv_log_name and OBJECT_TYPE='MVLOG';
update_mv_log_sql(p_base_object_name ,
p_base_object_type,
l_snapshot_log_sql_handle);
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'NOLOG') ;
DELETE bis_obj_indexes where OBJECT_NAME=l_mv_log_name and OBJECT_TYPE='MVLOG';
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'NOT_OVERWRITE_WITH_NULL') ;
update_mv_log_status(
p_base_object_name ,
p_base_object_type ,
'NOT_OVERWRITE_WITH_NULL') ;
update_mv_log_sql(p_base_object_name ,
p_base_object_type,
l_snapshot_log_sql_handle);
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'CAPTURED') ;
WRITELOG('Update BIS_OBJ_PROPERTIES TABLE with captured MV log definition');
update_obj_creation_date(p_base_object_name,p_base_object_type,p_base_object_schema);
update_mv_log_status(P_OBJ_NAME ,
P_OBJ_TYPE ,
'DROPPED') ;
l_stmt := 'select INDEX_NAME, INDEX_SQL from BIS_OBJ_INDEXES where OBJECT_NAME='''
||p_mv_log_name||
''' and OBJECT_TYPE=''MVLOG'' and INDEX_SQL is not null';
select count(*) into :l_count
from
bis_obj_properties PRP,
All_SNAPSHOT_LOGS LOG
where
log.master = PRP.object_name
and OBJECT_TYPE = :P_base_object_type
and OBJECT_NAME = :p_base_object_name
and log.log_owner = :P_base_object_schema;
select snapshot_log_sql into l_snapshot_log_sql_handle
from bis_obj_properties
where object_name = p_base_object_name
and object_type = P_base_object_type;
update_mv_log_status(p_base_object_name ,
p_base_object_type ,
'RECREATED');
select count(*) into l_count
from bis_obj_prog_linkages lkg
where
object_type <> 'MV'
and lkg.enabled_flag = 'Y'
and lkg.refresh_mode in ( 'INIT', 'INIT_INCR')
and object_type = p_object_type
and object_name = p_object_name;
select count(*) into l_count
from bis_obj_prog_linkages lkg
where
object_type = 'MV'
and lkg.enabled_flag = 'Y'
and lkg.refresh_mode in ( 'INIT', 'INIT_INCR')
and conc_program_name <> 'BIS_MV_REFRESH'
and object_type = p_object_type
and object_name = p_object_name;
select distinct
sets.request_set_name,
opt.option_name,
opt.option_value
from
fnd_run_requests req,
fnd_request_sets sets,
bis_request_set_options opt
where
req.parent_request_id = p_request_id
and sets.request_set_id = req.request_set_id
and req.application_id = 191
and sets.application_id = 191
and req.application_id = sets.application_id
and opt.request_set_name = sets.request_set_name
and opt.option_name IN ('FORCE_FULL', 'REFRESH_MODE');
select implementation_flag into l_impl
from bis_obj_properties
where object_name = P_OBJ_NAME
and object_type = 'TABLE';
select implementation_flag into l_impl
from bis_obj_properties
where object_name = P_OBJ_NAME
and object_type = 'TABLE';
select count(*) into l_exist
from
All_SNAPSHOT_LOGS LOG
where
log.master = P_OBJ_NAME
and log.log_owner = l_owner;
select DISTINCT PRP.object_name, PRP.object_type,
BIS_CREATE_REQUESTSET.get_object_owner(prp.object_name, prp.object_type) object_owner
from (
SELECT distinct DEPEND_OBJECT_TYPE OBJECT_TYPE
, DEPEND_OBJECT_NAME OBJECT_NAME
, DEPEND_OBJECT_OWNER OBJECT_OWNER
FROM BIS_OBJ_DEPENDENCY
WHERE DEPEND_OBJECT_TYPE = ''MV''
START WITH OBJECT_NAME in (
select object_name from bis_request_set_objects
where request_set_name = :p_request_set_name
and object_type = ''PAGE''
)
and enabled_flag = ''Y''
connect by object_name = prior depend_object_name
and object_type = prior depend_object_type
and enabled_flag = ''Y''
) PRP,
BIS_OBJ_PROPERTIES P
where prp.object_name = p.object_name
and prp.object_type = p.object_type
and p.implementation_flag = ''Y''
order by PRP.object_type, PRP.object_name
';
select DISTINCT object_name, object_type,
BIS_CREATE_REQUESTSET.get_object_owner(object_name, object_type) object_owner
from (
SELECT distinct DEPEND_OBJECT_TYPE OBJECT_TYPE
, DEPEND_OBJECT_NAME OBJECT_NAME
, DEPEND_OBJECT_OWNER OBJECT_OWNER
FROM BIS_OBJ_DEPENDENCY
WHERE DEPEND_OBJECT_TYPE = ''MV''
START WITH OBJECT_NAME in (
select object_name from bis_request_set_objects
where request_set_name = :p_request_set_name
and object_type = ''PAGE''
)
connect by object_name = prior depend_object_name
and object_type = prior depend_object_type
) PRP
order by object_type, object_name';