The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
b.mapping_id,
c.target_usage_id,
a.dim_id,
ltc.name,
ltc.elementid
from
edw_dimensions_md_v a,
edw_tables_md_v ltc,
edw_pvt_map_properties_md_v b,
edw_pvt_map_targets_md_v c
where
a.dim_name =p_dim_name
and b.primary_target=a.dim_id
and c.mapping_id=b.mapping_id
and c.target_id=a.dim_id
and ltc.elementid=b.primary_source;
select distinct
child_relation.name,
parent_relation.name,
child_fk_item.column_name,
parent_pk_item.column_name,
nvl(parent_map.mapping_id,0),
nvl(parent_map.primary_source,0),
nvl(parent_map.primary_target,0)
from
edw_levels_md_v lvl_child,
edw_levels_md_v lvl_parent,
edw_foreign_keys_md_v child_fk,
edw_pvt_key_columns_md_v child_fk_set_usage,
edw_pvt_columns_md_v child_fk_item,
edw_unique_keys_md_v parent_pk,
edw_pvt_key_columns_md_v parent_pk_set_usage,
edw_pvt_columns_md_v parent_pk_item,
edw_tables_md_v child_relation,
edw_tables_md_v parent_relation,
edw_pvt_level_relation_md_v lvl_rel,
edw_hierarchies_md_v hier,
edw_pvt_map_properties_md_v parent_map
where
hier.dim_id=p_dim_id
and lvl_rel.hierarchy_id=hier.hier_id
and lvl_child.level_id=lvl_rel.child_level_id
and lvl_parent.level_id=lvl_rel.parent_level_id
and child_fk.entity_id=child_relation.elementid
and child_fk.key_id=parent_pk.key_id
and child_fk_set_usage.key_id=child_fk.foreign_key_id
and child_fk_item.column_id=child_fk_set_usage.column_id
and child_fk_item.parent_object_id=child_relation.elementid
and parent_pk.entity_id=parent_relation.elementid
and parent_pk_set_usage.key_id=parent_pk.key_id
and parent_pk_item.column_id=parent_pk_set_usage.column_id
and parent_pk_item.parent_object_id=parent_relation.elementid
and parent_relation.name=lvl_parent.level_name||'_LTC'
and child_relation.name=lvl_child.level_name||'_LTC'
and parent_map.primary_target(+)=parent_relation.elementid;
select distinct
child_relation.name,
null,
null,
parent_pk_item.column_name,--actually child pk
parent_map.mapping_id, --actually child map
nvl(parent_map.primary_source,0),
nvl(parent_map.primary_target,0)
from
edw_levels_md_v lvl_child,
edw_unique_keys_md_v parent_pk,
edw_pvt_key_columns_md_v parent_pk_set_usage,
edw_pvt_columns_md_v parent_pk_item,
edw_tables_md_v child_relation,
edw_pvt_level_relation_md_v lvl_rel,
edw_hierarchies_md_v hier,
edw_pvt_map_properties_md_v parent_map
where
hier.dim_id=p_dim_id
and lvl_rel.hierarchy_id=hier.hier_id
and lvl_child.level_id=lvl_rel.child_level_id
and parent_pk.entity_id=child_relation.elementid
and parent_pk_set_usage.key_id=parent_pk.key_id
and parent_pk_item.column_id=parent_pk_set_usage.column_id
and parent_pk_item.parent_object_id=child_relation.elementid
and child_relation.name=lvl_child.level_name||'_LTC'
and parent_map.primary_target(+)=child_relation.elementid;
select
upper(dim_item.column_name),
upper(relation.name),
upper(level_item.column_name)
from
edw_pvt_map_properties_md_v map_properties,
edw_pvt_map_sources_md_v map_sources,
(select * from edw_pvt_map_columns_md_v where mapping_id=p_mapping_id) map_columns,
edw_tables_md_v relation,
edw_pvt_columns_md_v dim_item,
edw_pvt_columns_md_v level_item
where
map_properties.mapping_id=p_mapping_id
and map_sources.mapping_id=map_properties.mapping_id
and map_columns.Target_column_id=dim_item.column_id
and map_columns.source_column_id=level_item.column_id
and relation.elementid=map_sources.source_id
and map_columns.Source_usage_id=map_sources.Source_usage_id;
select
lvl.level_prefix||'_'||item.column_name||'_ROWID',
lvl.level_name||'_LTC',
'ROWID'
from
edw_levels_md_v lvl,
edw_pvt_level_columns_md_v item
where
lvl.dim_id=p_dim_id
and item.level_id=lvl.level_id
and item.column_name like '%_PK';
select
map.mapping_id,
nvl(map.primary_source,0),
nvl(map.primary_target,0)
from
edw_pvt_map_properties_md_v map,
edw_relations_md_v relation
where
map.primary_target=relation.relation_id
and relation.relation_name=p_target_relation;
select
fact_map.mapping_id,
fact_map.primary_source,
fact_map.primary_target
into
p_fact_map_id,
p_fact_src,
p_fact_target
from
edw_facts_md_v fact,
edw_pvt_map_properties_md_v fact_map
where
fact.fact_name=p_fact_name
and fact_map.primary_target=fact.fact_id;
l_stmt:='select rel.name from edw_tables_md_v rel, edw_facts_md_v fact, edw_foreign_keys_md_v fk, '||
'edw_unique_keys_md_v pk where fact.fact_name=:a and fk.entity_id=rel.elementid '||
'and pk.entity_id=fact.fact_id and fk.key_id=pk.key_id '||
'and fk.foreign_key_name like ''%_DLOG''';
l_stmt:='select rel.RELATION_NAME from edw_relations_md_v rel, edw_facts_md_v fact, edw_foreign_keys_md_v fk, '||
'edw_unique_keys_md_v pk where fact.fact_name=:a and fk.entity_id=rel.RELATION_ID '||
'and pk.entity_id=fact.fact_id and fk.key_id=pk.key_id '||
'and rel.description=:b';
l_stmt:='select col.column_name from edw_pvt_columns_md_v col, edw_relations_md_v rel where rel.relation_name=:s and '||
' col.parent_object_id=rel.relation_id ';
select column_name,data_type,data_length,num_distinct,num_nulls,avg_col_len from all_tab_columns
where table_name=p_table and owner=p_owner;
write_to_log_file_n('select column_name,data_type,data_length,num_distinct,num_nulls,'||
'avg_col_len from all_tab_columns where table_name='||l_table||' and owner='||l_owner);
l_stmt:='select col.column_name from edw_pvt_columns_md_v col, edw_relations_md_v rel, edw_foreign_keys_md_v fk, '||
'edw_pvt_key_columns_md_v fku where rel.relation_name=:a and fk.entity_id=rel.relation_id and '||
'fku.key_id=fk.foreign_key_id and col.column_id=fku.column_id and col.parent_object_id=rel.relation_id';
l_stmt:='select fk_item.column_name,p_rel.relation_name '||
'from '||
'edw_relations_md_v rel, '||
'edw_foreign_keys_md_v fk, '||
'edw_pvt_key_columns_md_v fkisu, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_relations_md_v p_rel, '||
'edw_unique_keys_md_v pk '||
'where '||
'rel.relation_name=:a '||
'and fk.entity_id=rel.relation_id '||
'and fkisu.key_id=fk.foreign_key_id '||
'and fk_item.column_id=fkisu.column_id '||
'and fk_item.parent_object_id=rel.relation_id '||
'and pk.key_id=fk.key_id '||
'and p_rel.relation_id=pk.entity_id';
l_stmt:='select table_owner from user_synonyms where table_name=:a';
l_stmt:='select log_table from all_snapshot_logs where master=:a and log_owner=:b'; --rkumar:bug#4905343
function delete_table(p_table varchar2) return boolean is
l_stmt varchar2(1000);
l_stmt:='delete '||p_table;
write_to_log_file_n('Deleted '||sql%rowcount||' records from '||p_table);
write_to_log_file_n('Exception in delete_table '||sqlerrm);
SELECT edw_language_code INTO l_lang
FROM edw_system_parameters;
the below code was there when we thought that we need to translate before inserting into the
log tables. now its decided that the conversion needs to happen in the form. so the below portion is
not needed.
*/
l_lang := get_wh_language;
SELECT
meaning
INTO
l_meaning
FROM fnd_lookup_values
WHERE lookup_code= p_lookup_code
AND lookup_type= p_lookup_type
AND language = l_lang;
p_number_insert number,
p_number_update number,
p_number_delete number,
p_collection_message varchar2,
p_status varchar2,
p_load_pk number) return boolean is
l_stmt varchar2(10000);
l_insert_flag boolean;
l_stmt:='select 1 from edw_collection_detail_log where load_pk=:a';
l_insert_flag:=true;
l_insert_flag:=false;
if l_insert_flag then
l_stmt:='insert into edw_collection_detail_log(load_pk,object_name, object_id,object_type,COLLECTION_CONCURRENT_ID, '||
'COLLECTION_START_DATE,COLLECTION_END_DATE, '||
' NO_ACTUALLY_COLLECTED,NO_OF_READY_RECORDS,NO_OF_SUCC_PROCESSED_RECORDS, NUMBER_INSERT,'||
' NUMBER_UPDATE,NUMBER_DELETE,COLLECTION_STATUS, COLLECTION_EXCEPTION_MESSAGE,CREATION_DATE,'||
'CREATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN,LAST_UPDATE_BY) '||
' values (:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20) ';
p_rows_processed||','||p_number_insert||','||p_number_update||','||p_number_delete||','||
l_collection_status||','||p_collection_message||','||sysdate||','||
p_conc_program_id||','||sysdate||','||p_conc_program_id||','||p_conc_program_id);
p_rows_collected,p_rows_ready,p_rows_processed,p_number_insert,p_number_update,p_number_delete,
l_collection_status,p_collection_message,sysdate,
p_conc_program_id,sysdate,p_conc_program_id,p_conc_program_id;
write_to_log_file_n('Inserted '||sql%rowcount||' record into edw_collection_detail_log');
l_stmt:='update edw_collection_detail_log set COLLECTION_END_DATE=:a1, '||
' NO_ACTUALLY_COLLECTED=:a2,NO_OF_READY_RECORDS=:a3,NO_OF_SUCC_PROCESSED_RECORDS=:a4, '||
'NUMBER_INSERT=:a5,NUMBER_UPDATE=:a6,NUMBER_DELETE=:a7, '||
'COLLECTION_STATUS=:a8, COLLECTION_EXCEPTION_MESSAGE=:a9,LAST_UPDATE_DATE=:a10,'||
'LAST_UPDATE_LOGIN=:a11,LAST_UPDATE_BY=:a12 where load_pk=:a13';
p_rows_processed||','||p_number_insert||','||p_number_update||','||p_number_delete||','||
l_collection_status||','||p_collection_message||','||sysdate||','||
p_conc_program_id||','||p_conc_program_id||','||p_load_pk);
p_number_insert,p_number_update,p_number_delete,
l_collection_status,p_collection_message,sysdate,p_conc_program_id,p_conc_program_id,p_load_pk;
write_to_log_file_n('Updated '||sql%rowcount||' record in edw_collection_detail_log');
l_stmt:='insert into edw_general_log (OBJECT_NAME,OBJECT_TYPE,LOG_TYPE,CONCURRENT_ID,START_DATE, '||
' END_DATE,MESSAGE,STATUS )'||
' values (:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8) ';
write_to_log_file_n('Inserted '||sql%rowcount||' records into edw_general_log');
l_stmt:='insert into edw_error_log (OBJECT_NAME,OBJECT_TYPE,ERROR_TYPE,CONCURRENT_ID,START_DATE, '||
' END_DATE,MESSAGE,STATUS ,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CREATED_BY, '||
' LAST_UPDATE_LOGIN,RESP_ID)'||
' values (:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14) ';
write_to_log_file_n('Inserted '||sql%rowcount||' records into edw_error_log');
function insert_temp_log_table(
p_object_name varchar2,
p_object_type varchar2,
p_concurrent_req_id number,
p_ins_instance_name varcharTableType,
p_ins_request_id_table numberTableType,
p_ins_rows_ready numberTableType,
p_ins_rows_processed numberTableType,
p_ins_rows_collected numberTableType,
p_ins_rows_dangling numberTableType,
p_ins_rows_duplicate numberTableType,
p_ins_rows_error numberTableType,
p_number_ready number,
p_number_insert number,
p_number_update number,
p_number_delete number,
p_number_ins_req_coll number) return boolean is
l_stmt varchar2(10000);
write_to_log_file_n('In EDW_OWB_COLLECTION_UTIL.insert_temp_log_table');
'number_insert number_update number_delete');
||' '||p_ins_rows_duplicate(i)||' '||p_ins_rows_error(i)||' '||p_number_ready||' '||p_number_insert
||' '||p_number_update||' '||p_number_delete);
l_stmt:='insert into edw_temp_collection_log(object_name, object_type, concurrent_id,instance, request_id, rows_ready, '||
' rows_processed, rows_collected, rows_dangling, rows_duplicate, rows_error, status,number_ready,'||
'number_insert,number_update,number_delete) values '||
'(:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16)';
p_number_insert,p_number_update,p_number_delete;
write_to_log_file_n('Error in insert_temp_log_table '||sqlerrm||get_time);
l_stmt:='select 1 from '||p_table||' where rownum=1';
l_stmt:='select 1 from '||p_owner||'.'||p_table||' where rownum=1';
l_stmt:='select table_owner from user_synonyms where table_name=:a';
l_stmt:='select trg.trigger_name, trg.status from all_triggers trg where trg.table_name=:a '||
'and trg.owner=:b'; --rkumar:4905343
l_stmt:='select df.fact_id from edw_facts_md_v df, edw_facts_md_v fact, '||
'edw_pvt_map_properties_md_v map '||
'where fact.fact_name=:a and map.primary_source=fact.fact_id and df.fact_id=map.primary_target ';
l_stmt:='select 1 from edw_facts_md_v df, edw_facts_md_v fact, '||
'edw_pvt_map_properties_md_v map, edw_attribute_sets_md_v sis '||
'where fact.fact_name=:a and map.primary_source=fact.fact_id and df.fact_id=map.primary_target '||
'and sis.entity_id=df.fact_id and sis.attribute_group_name=''EDW_INC_REFRESH''';
l_stmt:='select df.fact_name, df.fact_id, map.mapping_id from edw_facts_md_v df, edw_facts_md_v fact, '||
'edw_pvt_map_properties_md_v map '||
'where fact.fact_name=:a and map.primary_source=fact.fact_id and df.fact_id=map.primary_target';
l_stmt:='select table_owner from user_synonyms where synonym_name=:a';
l_stmt:='select table_owner from user_synonyms where table_name=:a'; --rkumar:bug#4905343
l_stmt:='select owner from all_tables where table_name=:a '||
' and owner=:b'; --rkumar:bug#4905343
if p_action='INSERT' then
l_stmt:='insert into edw_coll_progress_log(object_name,object_type,status,number_processed, '||
'last_update_date,last_update_login,creation_date,created_by,last_update_by ) values ( '||
' :a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9) ';
elsif p_action='UPDATE' then
l_stmt:='update edw_coll_progress_log set status=:c,number_processed=:d, '||
'last_update_date=:e,last_update_login=:f,last_update_by=:g where object_name=:a and '||
' object_type=:b ';
elsif p_action='DELETE' then
l_stmt:='delete edw_coll_progress_log where object_name=:a and object_type=:b ';
l_stmt:='select last_update_by from edw_coll_progress_log where object_name=:a and object_type=:b';
write_to_log_file_n('last update by found from edw_coll_progress_log is '||l_var);
if record_coll_progress(p_object_name,p_object_type,0,'PROCESSING','INSERT') = false then
return 0;
/*if record_coll_progress(p_object_name,p_object_type,0,'PROCESSING','INSERT') = false then
return 0;
if record_coll_progress(p_object_name,p_object_type,null,null,'DELETE') = false then
return 0;
if record_coll_progress(p_object_name,p_object_type,0,'PROCESSING','INSERT') = false then
return 0;
l_stmt:='select 1 from '||p_table||' where rownum=1';
l_stmt:='select 1 from '||p_table||' where '||p_where||' and rownum=1';
l_stmt:='select 1 from edw_pvt_map_properties_md_v map, edw_relations_md_v rel where rel.relation_name=:a and '||
' map.primary_source=rel.relation_id and rownum=1';
l_stmt:=l_stmt||' as select ';
l_stmt:='select 1 from edw_dimensions_md_v dim,edw_attribute_sets_md_v sis where sis.attribute_group_name=:a '||
' and sis.entity_id=dim.dim_id and dim.dim_name=:b';
l_stmt:='select dim.dim_name from edw_dimensions_md_v dim,edw_attribute_sets_md_v sis where sis.attribute_group_name=:a '||
' and sis.entity_id=dim.dim_id and dim.dim_name in ('||l_in_clause||')';
l_stmt:='select 1 from '||p_table;
l_stmt:='select pk_item.column_name from edw_unique_keys_md_v pk,edw_pvt_columns_md_v pk_item,edw_relations_md_v rel, '||
'edw_pvt_key_columns_md_v isu where rel.relation_name=:a and pk.entity_id=rel.relation_id '||
'and isu.key_id=pk.key_id and pk_item.column_id=isu.column_id and pk_item.column_name like ''%_KEY'' '||
'and pk_item.parent_object_id=rel.relation_id';
l_stmt:='select 1 from edw_facts_md_v fact, edw_attribute_sets_md_v sis '||
' where fact.fact_name=:a and sis.entity_id=fact.fact_id and sis.attribute_group_name=''EDW_INC_REFRESH''';
l_stmt:='select 1 from edw_dimensions_md_v dim, edw_attribute_sets_md_v sis '||
' where dim.dim_name=:a and sis.entity_id=dim.dim_id '||
'and sis.attribute_group_name=''EDW_LEVEL_PUSH_DOWN''';
function is_delete_trigger_imp(p_object varchar2, p_owner varchar2) return boolean is
l_stmt varchar2(10000);
write_to_log_file_n('In is_delete_trigger_imp');
l_stmt:='select triggering_event from all_triggers where table_name =:a and table_owner=:b';
if l_type='DELETE' then
return true;
function insert_into_coll_progress(
OBJECT_NAME VARCHAR2
, OBJECT_TYPE VARCHAR2
, STATUS VARCHAR2
, NUMBER_PROCESSED NUMBER ) return boolean is
l_stmt varchar2(4000);
write_to_log_file_n('In insert_into_coll_progress');
l_stmt:='insert into edw_coll_progress_log(OBJECT_NAME,OBJECT_TYPE,STATUS, '||
' NUMBER_PROCESSED,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN,CREATION_DATE, '||
' CREATED_BY,LAST_UPDATE_BY) values (:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9)';
l_stmt:=' select '||
'sec_relation.relation_name, '||
'sec_relation.relation_id, '||
'sec_relation_child.relation_name, '||
'sec_relation_child.relation_id, '||
'pk_item.column_name, '||
'fk_item.column_name, '||
'sec_relation_usage.source_usage_id, '||
'sec_relation_usage.source_alias, '||
'sec_relation_child_usage.source_usage_id '||
'from '||
'edw_pvt_map_sources_md_v sec_relation_usage, '||
'edw_relations_md_v sec_relation, '||
'edw_pvt_map_sources_md_v sec_relation_child_usage, '||
'edw_relations_md_v sec_relation_child, '||
'edw_pvt_map_key_usages_md_v fk_usage, '||
'edw_pvt_key_columns_md_v fk_isu, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_pvt_key_columns_md_v pk_isu, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
' sec_relation_usage.mapping_id=:a '||
'and sec_relation.relation_id=sec_relation_usage.source_id '||
'and sec_relation_child_usage.mapping_id=sec_relation_usage.mapping_id '||
'and sec_relation_child.relation_id=sec_relation_child_usage.source_id '||
'and fk_usage.source_usage_id=sec_relation_child_usage.source_usage_id '||
'and fk_usage.Parent_table_usage_id=sec_relation_usage.source_usage_id '||
'and fk_usage.mapping_id=sec_relation_usage.mapping_id '||
'and fk_isu.key_id=fk_usage.foreign_key_id '||
'and fk_item.column_id=fk_isu.column_id '||
'and fk_item.parent_object_id=sec_relation_child.relation_id '||
'and pk_isu.key_id=fk_usage.unique_key_id '||
'and pk_item.column_id=pk_isu.column_id '||
'and pk_item.parent_object_id=sec_relation.relation_id '||
'order by sec_relation_usage.source_usage_id';
procedure insert_into_load_progress(p_load_fk number,p_object_name varchar2,p_object_id number,
p_load_progress varchar2,p_start_date date,p_end_date date,p_category varchar2, p_operation varchar2,
p_seq_id varchar2,p_flag varchar2,p_obj_id number) is
l_stmt varchar2(2000);
l_stmt:='update edw_load_progress_log set end_date=:a1,last_update_date=:a2 '||
'where load_fk=:a3 and seq_id=:a4 and obj_id=:a5';
l_stmt:='insert into edw_load_progress_log(load_fk,seq_id,obj_id,object_name,object_id,load_progress,start_date,end_date,'||
'category,operation,creation_date,last_update_date,created_by,last_update_by,last_update_login) '||
'values(:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15)';
l_stmt:='select item.column_name from edw_attribute_sets_md_v sis, edw_attribute_set_columns_md_v isu, '||
'edw_pvt_columns_md_v item, '||
'edw_relations_md_v rel where rel.relation_name=:a and sis.entity_id=rel.relation_id '||
'and sis.attribute_group_name=:b and isu.attribute_group_id=sis.attribute_group_id and '||
'item.column_id=isu.column_id and item.parent_object_id=rel.relation_id';
l_stmt:='select level_prefix from edw_levels_md_v where level_name=:a';
l_stmt:='select src_it.column_name,tgt_it.column_name '||
'from '||
'edw_relations_md_v src_rel, '||
'edw_relations_md_v tgt_rel, '||
'edw_pvt_map_sources_md_v map_sources, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns, '||
'edw_pvt_map_properties_md_v map, '||
'edw_pvt_columns_md_v tgt_it, '||
'edw_pvt_columns_md_v src_it '||
'where '||
'tgt_rel.relation_name=:a '||
'and src_rel.relation_name=:b '||
'and map.primary_target=tgt_rel.relation_id '||
'and map_sources.mapping_id=map.mapping_id '||
'and map_sources.source_id=src_rel.relation_id '||
'and map_columns.source_usage_id=map_sources.source_usage_id '||
'and tgt_it.column_id=map_columns.Target_column_id '||
'and src_it.column_id=map_columns.source_column_id '||
'and tgt_it.parent_object_id=tgt_rel.relation_id '||
'and src_it.parent_object_id=src_rel.relation_id ';
l_stmt:='select src_it.column_name,tgt_it.column_name '||
'from '||
'edw_relations_md_v src_rel, '||
'edw_relations_md_v tgt_rel, '||
'edw_pvt_map_sources_md_v map_sources, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns, '||
'edw_pvt_map_properties_md_v map, '||
'edw_pvt_columns_md_v tgt_it, '||
'edw_pvt_columns_md_v src_it, '||
'edw_pvt_mappings_md_v model '||
'where '||
'tgt_rel.relation_name=:a '||
'and src_rel.relation_name=:b '||
'and model.mapping_name=:c '||
'and map.primary_target=tgt_rel.relation_id '||
'and model.mapping_id=map.mapping_id '||
'and map_sources.mapping_id=map.mapping_id '||
'and map_sources.source_id=src_rel.relation_id '||
'and map_columns.source_usage_id=map_sources.source_usage_id '||
'and tgt_it.column_id=map_columns.Target_column_id '||
'and src_it.column_id=map_columns.source_column_id '||
'and tgt_it.parent_object_id=tgt_rel.relation_id '||
'and src_it.parent_object_id=src_rel.relation_id ';
l_stmt:='select map.mapping_id,map.primary_target, map.primary_source '||
'from edw_pvt_map_properties_md_v map, edw_relations_md_v src, edw_relations_md_v tgt, '||
'edw_pvt_mappings_md_v model where map.primary_target=tgt.relation_id and '||
'map.primary_source=src.relation_id and tgt.relation_name=:a and src.relation_name=:b and '||
'model.mapping_name=:c and model.mapping_id=map.mapping_id';
l_stmt:='select '||
'src.relation_name, '||
'src_col.column_name, '||
'tgt.relation_name, '||
'tgt_col.column_name '||
'from '||
'edw_relations_md_v src, '||
'edw_relations_md_v tgt, '||
'edw_pvt_columns_md_v src_col, '||
'edw_pvt_columns_md_v tgt_col, '||
'edw_pvt_map_properties_md_v map, '||
'edw_pvt_map_sources_md_v map_source, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns '||
'where '||
'map.mapping_id=:a '||
'and map_source.mapping_id=map.mapping_id '||
'and map_source.source_id=src.relation_id '||
'and map_columns.source_usage_id=map_source.source_usage_id '||
'and map.primary_target=tgt.relation_id '||
'and map.primary_source=src.relation_id '||
'and src_col.column_id=map_columns.Source_column_id '||
'and tgt_col.column_id=map_columns.target_column_id '||
'and tgt_col.parent_object_id=tgt.relation_id '||
'and src_col.parent_object_id=src.relation_id ';
l_stmt:='select 1 from edw_dimensions_md_v dim, edw_attribute_sets_md_v sis '||
' where dim.dim_name=:a and sis.entity_id=dim.dim_id and sis.attribute_group_name=:b ';
l_stmt:='select index_name, column_name,column_position from all_ind_columns where table_name=:a and TABLE_OWNER=:b';
l_stmt:='select relation_id from edw_relations_md_v where relation_name=:a';
l_stmt:='select dim_id from edw_dimensions_md_v where dim_name=:a';
l_stmt:='select last_analyzed from all_tables where table_name=:a and owner=:b';
l_stmt:='select table_owner from user_synonyms where table_name=:a';
l_stmt:='select last_analyzed from all_tables where table_name=:a and owner=:b';--rkumar:bug#4905343
l_stmt:='select ';
l_stmt:='select tablespace_name,initial_extent,next_extent,pct_free,pct_used,pct_increase,max_extents,'||
'avg_row_len from '||
'all_tables where table_name=:a and owner=:b';
l_stmt:='select next_extent from all_tables where table_name=:a and owner=:b';
l_stmt:='select '||
'pk_item.column_name '||
'from '||
'edw_relations_md_v rel , '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v isu, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
'rel.relation_name=:a '||
'and pk.entity_id=rel.relation_id '||
'and pk.primarykey <> 1 '||
'and isu.key_id=pk.key_id '||
'and pk_item.column_id=isu.column_id '||
'and pk_item.parent_object_id=rel.relation_id '||
'and pk_item.data_type<>''NUMBER''';
l_stmt:='select 1 from all_tab_columns where table_name=:a and column_name=:b and owner=:c';
l_stmt:='select 1 from all_tab_columns,user_synonyms syn where all_tab_columns.table_name=:a '||
'and column_name=:b and syn.table_name=all_tab_columns.table_name and syn.table_owner=all_tab_columns.owner';
l_stmt:='select default_tablespace from dba_users where username=:a';
l_stmt:='select 1 '||
'from all_indexes a,all_ind_columns b '||
'where '||
'a.index_name=b.index_name '||
'and a.owner=b.index_owner '||
'and a.uniqueness=''UNIQUE'' '||
'and a.table_name=:a '||
'and a.table_owner=:b '||
'and a.index_name in '||
'(select c.index_name from all_ind_columns c '||
'where a.index_name=c.index_name '||
'and a.owner=c.index_owner '||
'and c.column_name=:c) '||
'having count(*)=1 '||
'group by b.index_name ';
l_stmt:='select 1 from all_ind_columns where table_name=:a and table_owner=:b and column_name=:c';
l_stmt:='select '||
'func_name,'||
'category_name,'||
'column_name,'||
'column_id,'||
'column_usage_id ,'||
'aggregation,'||
'is_distinct,'||
'relation_id,'||
'relation_name,'||
'relation_usage_id,'||
'relation_type,'||
'func_usage_id,'||
'attribute_position,'||
'func_default_value '||
'from '||
'edw_pvt_map_func_md_v map '||
'where '||
'map.mapping_id=:a ';
l_stmt:='select '||
'''COPY'' func_name, '||
'''Basic'' category_name, '||
'col.column_name column_name, '||
'col.column_id, '||
'map_col.target_column_usage_id column_usage_id , '||
'null, '||
'null, '||
'rel.relation_id, '||
'rel.relation_name, '||
'map_col.target_usage_id relation_usage_id, '||
'rel.relation_type, '||
'map_col.func_usage_id, '||
'1 attribute_position, '||
'null '||
'from '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_col, '||
'edw_relations_md rel, '||
'edw_pvt_columns_md col, '||
'edw_pvt_map_targets_md tgt '||
'where '||
'rel.relation_id=tgt.target_id '||
'and tgt.mapping_id=map_col.mapping_id '||
'and tgt.target_usage_id=map_col.target_usage_id '||
'and col.column_id=map_col.target_column_id ';
l_stmt:='select '||
'''COPY'' func_name, '||
'''Basic'' category_name, '||
'nvl(col.column_name,''NEXTVAL'') column_name, '||
'col.column_id, '||
'map_col.source_column_usage_id column_usage_id , '||
'null, '||
'null, '||
'rel.relation_id, '||
'rel.relation_name, '||
'map_col.source_usage_id relation_usage_id, '||
'rel.relation_type, '||
'map_col.func_usage_id, '||
'1 attribute_position, '||
'null '||
'from '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_col, '||
'edw_relations_md rel, '||
'edw_pvt_columns_md col, '||
'edw_pvt_map_sources_md src '||
'where '||
'rel.relation_id=src.source_id '||
'and src.mapping_id=map_col.mapping_id '||
'and src.source_usage_id=map_col.source_usage_id '||
'and col.column_id(+)=map_col.source_column_id ';
l_stmt:='select '||
'distinct map.mapping_id, '||
'tgt.fact_id, '||
'src.fact_id '||
'from '||
'edw_pvt_map_sources_md_v ru, '||
'edw_dimensions_md_v rel, '||
'edw_pvt_map_properties_md_v map, '||
'edw_facts_md_v src, '||
'edw_facts_md_v tgt, '||
'edw_attribute_sets_md_v sis '||
'where '||
'ru.mapping_id=map.mapping_id '||
'and rel.dim_id=ru.source_id '||
'and rel.dim_name=:a '||
'and map.primary_source=src.fact_id '||
'and map.primary_target=tgt.fact_id '||
'and sis.attribute_group_name=''EDW_INC_REFRESH'' '||
'and sis.entity_id=tgt.fact_id';
l_stmt:='select '||
'distinct map.mapping_id, '||
'tgt.fact_id, '||
'src.fact_id '||
'from '||
'edw_pvt_map_sources_md_v ru, '||
'edw_dimensions_md_v rel, '||
'edw_pvt_map_properties_md_v map, '||
'edw_facts_md_v src, '||
'edw_facts_md_v tgt '||
'where '||
'ru.mapping_id=map.mapping_id '||
'and rel.dim_id=ru.source_id '||
'and rel.dim_name=:a '||
'and map.primary_source=src.fact_id '||
'and map.primary_target=tgt.fact_id ';
l_stmt:='select lvl.level_prefix||''_''||item.column_name '||
'from '||
'edw_foreign_keys_md_v fk, '||
'edw_unique_keys_md_v pk, '||
'edw_dimensions_md_v dim, '||
'edw_levels_md_v lvl, '||
'edw_tables_md_v ltc, '||
'edw_unique_keys_md_v ltc_pk, '||
'edw_pvt_columns_md_v item, '||
'edw_pvt_key_columns_md_v isu '||
'where '||
'fk.entity_id=:a '||
'and fk.key_id=pk.key_id '||
'and dim.dim_id=pk.entity_id '||
'and dim.dim_id=:b '||
'and lvl.dim_id=dim.dim_id '||
'and lvl.level_prefix=substr(fk.foreign_key_name,instr(fk.foreign_key_name,''_'',-1)+1,length(fk.foreign_key_name)) '||
'and ltc.name=lvl.level_name||''_LTC'' '||
'and ltc_pk.entity_id=ltc.elementid '||
'and isu.key_id=ltc_pk.key_id '||
'and isu.column_id=item.column_id '||
'and item.parent_object_id=ltc.elementid '||
'and item.data_type=''NUMBER''';
l_stmt:='select relation_name from edw_relations_md_v where relation_id=:a';
l_stmt:='select edw_load_s.nextval from dual';
l_stmt:='select pk_item.column_name, fk_item.column_name '||
'from '||
'edw_pvt_map_properties_md_v map, '||
'edw_pvt_map_sources_md_v map_sources_dim, '||
'edw_pvt_map_sources_md_v map_sources_fact, '||
'edw_pvt_map_key_usages_md_v map_key_usage, '||
'edw_pvt_key_columns_md_v fk_key_column, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_pvt_key_columns_md_v pk_key_column, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
'map_sources_dim.source_id=:a '||
'and map_sources_fact.source_id=:b '||
'and map.mapping_id=:c '||
'and map_sources_dim.mapping_id=map.mapping_id '||
'and map_sources_fact.mapping_id=map.mapping_id '||
'and map_key_usage.source_usage_id=map_sources_fact.source_usage_id '||
'and map_key_usage.mapping_id=map.mapping_id '||
'and fk_key_column.key_id=map_key_usage.foreign_key_id '||
'and fk_item.column_id=fk_key_column.column_id '||
'and fk_item.parent_object_id=map_sources_fact.source_id '||
'and pk_key_column.key_id=map_key_usage.unique_key_id '||
'and pk_item.column_id=pk_key_column.column_id '||
'and pk_item.parent_object_id=map_sources_dim.source_id ';
l_stmt:='select pk_item.column_name,fk_item.column_name '||
'from '||
'edw_foreign_keys_md_v fk, '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v fk_use, '||
'edw_pvt_key_columns_md_v pk_use, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
' pk.entity_id=:a '||
'and fk.entity_id=:b '||
'and fk_use.key_id=fk.foreign_key_id '||
'and fk_item.column_id=fk_use.column_id '||
'and fk_item.parent_object_id=fk.entity_id '||
'and pk.key_id=fk.key_id '||
'and pk_use.key_id=pk.key_id '||
'and pk_item.column_id=pk_use.column_id '||
'and pk_item.parent_object_id=pk.entity_id ';
l_stmt:='select mapping_id from edw_pvt_map_properties_md_v where primary_target=:a';
l_stmt:='select 1 from edw_relations_md_v rel,edw_attribute_sets_md_v sis where sis.attribute_group_name=:a '||
' and sis.entity_id=rel.relation_id and rel.relation_name=:b';
l_stmt:='select 1 from edw_attribute_sets_md_v sis where sis.attribute_group_name=:a and sis.entity_id=:b';
l_stmt:='select instr(lower(description),''master instance'') from edw_relations_md_v where relation_name=:a';
l_stmt:='select rtrim(ltrim(substr(upper(description),instr(lower(description),''master instance'')+16,'||
'length(description)))) from edw_relations_md_v where relation_name=:a';
l_stmt:='insert into EDW_CDI_RESULTS('||
'OBJECT_NAME '||
',OBJECT_ID '||
',OBJECT_TYPE '||
',INTERFACE_TABLE '||
',INTERFACE_TABLE_ID '||
',INTERFACE_TABLE_PK '||
',INTERFACE_TABLE_PK_ID '||
',INTERFACE_TABLE_FK '||
',INTERFACE_TABLE_FK_ID '||
',PARENT_TABLE '||
',PARENT_TABLE_ID '||
',PARENT_TABLE_PK '||
',PARENT_TABLE_PK_ID '||
',NUMBER_DANGLING '||
',NUMBER_DUPLICATE '||
',NUMBER_ERROR '||
',TOTAL_RECORDS '||
',ERROR_TYPE '||
',CREATED_BY '||
',LAST_UPDATE_BY '||
',LAST_UPDATE_LOGIN '||
',CREATION_DATE '||
',LAST_UPDATE_DATE) '||
'values (:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20,'||
':a21,:a22,:a23)';
l_stmt:='insert into edw_cdi_key_values (key_id,table_id,parent_table_id,instance,key_value,number_key_value,'||
'bad_key) values(:a1,:a2,:a3,:a4,:a5,:a6,:a7)';
l_stmt:='select item.column_id from edw_pvt_columns_md_v item, edw_relations_md_v rel where rel.relation_name=:a '||
'and item.column_name=:b and item.parent_object_id=rel.relation_id and item.parent_object_id=rel.relation_id';
l_stmt:='select fk_item.column_name from edw_relations_md_v rel, edw_foreign_keys_md_v fk, '||
'edw_pvt_key_columns_md_v fkisu,edw_pvt_columns_md_v fk_item,edw_dimensions_md_v p_rel,edw_unique_keys_md_v pk '||
'where rel.relation_name=:a and fk.entity_id=rel.relation_id and fkisu.key_id=fk.foreign_key_id '||
'and fk_item.column_id=fkisu.column_id and fk_item.parent_object_id=rel.relation_id and pk.key_id=fk.key_id and '||
'p_rel.dim_id=pk.entity_id and p_rel.dim_name=''EDW_INSTANCE_M''';
l_stmt:='select item.column_name from edw_pvt_columns_md_v item, edw_relations_md_v rel where '||
'item.parent_object_id=rel.relation_id and rel.relation_name=:a and item.column_name '||
'in (''INSTANCE'',''INSTANCE_CODE'') and item.parent_object_id=rel.relation_id';
l_stmt:='select 1 from edw_facts_md_v df, edw_facts_md_v fact, '||
'edw_pvt_map_properties_md_v map, edw_attribute_sets_md_v sis '||
'where fact.fact_name=:a and map.primary_source=fact.fact_id and df.fact_id=map.primary_target '||
'and sis.entity_id=df.fact_id and sis.attribute_group_name=''EDW_CUSTOM_INC_REFRESH''';
l_stmt:='select vw.view_name '||
'from '||
'edw_pvt_md_views_v vw, '||
'edw_dimensions_md_v dim, '||
'edw_foreign_keys_md_v fk, '||
'edw_unique_keys_md_v pk '||
'where fk.entity_id=vw.view_id '||
'and pk.entity_id=dim.dim_id '||
'and fk.key_id=pk.key_id '||
'and instr(fk.foreign_key_name,''_PK_VIEW'')<>0 '||
'and dim.dim_name=:a ';
l_stmt:='select '||l_pkg||' from dual';
l_stmt:='select 1 from '||l_view(i)||'@'||p_db_link||' where rownum=1';
l_stmt:='select relation_long_name from edw_relations_md_v where relation_id=:a';
l_stmt:='select '||
'tgt_column.column_name '||
'from '||
'edw_pvt_map_properties_md_v map_properties, '||
'edw_pvt_map_sources_md_v map_sources, '||
'edw_pvt_map_targets_md_v map_targets, '||
'edw_tables_md_v src_table, '||
'edw_relations_md_v tgt_relation, '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v key_usage, '||
'edw_pvt_columns_md_v pk_col, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns, '||
'edw_pvt_columns_md_v tgt_column '||
'where '||
' map_sources.source_id=map_properties.primary_source '||
'and map_targets.target_id=map_properties.primary_target '||
'and map_properties.mapping_id=:a '||
'and map_sources.mapping_id=map_properties.mapping_id '||
'and src_table.elementid=map_sources.source_id '||
'and map_targets.mapping_id=map_properties.mapping_id '||
'and tgt_relation.relation_id=map_targets.target_id '||
'and pk.entity_id=map_properties.primary_source '||
'and key_usage.key_id=pk.key_id '||
'and pk_col.column_id=key_usage.column_id '||
'and pk_col.parent_object_id=src_table.elementid '||
'and map_columns.mapping_id=map_properties.mapping_id '||
'and map_columns.Source_usage_id=map_sources.source_usage_id '||
'and map_columns.Source_column_id=pk_col.column_id '||
'and map_columns.Target_column_id=tgt_column.column_id '||
'and tgt_column.parent_object_id=tgt_relation.relation_id ';
l_stmt:='select map.mapping_id '||
'from edw_pvt_map_properties_md_v map, '||
'edw_relations_md_v rel '||
'where rel.relation_name=:a '||
'and map.primary_target=rel.relation_id ';
l_stmt:='select '||
'src.relation_name, '||
'src_col.column_name, '||
'tgt.relation_name, '||
'tgt_col.column_name '||
'from '||
'edw_relations_md_v src, '||
'edw_relations_md_v tgt, '||
'edw_pvt_columns_md_v src_col, '||
'edw_pvt_columns_md_v tgt_col, '||
'edw_pvt_map_properties_md_v map, '||
'edw_pvt_map_sources_md_v map_source, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns '||
'where '||
'map.mapping_id=:a '||
'and map_source.mapping_id=map.mapping_id '||
'and map_columns.mapping_id=map.mapping_id '||
'and map_source.source_id=src.relation_id '||
'and map_columns.source_usage_id=map_source.source_usage_id '||
'and map.primary_target=tgt.relation_id '||
'and src_col.column_id=map_columns.Source_column_id '||
'and tgt_col.column_id=map_columns.target_column_id '||
'and src_col.parent_object_id=src.relation_id '||
'and tgt_col.parent_object_id=tgt.relation_id ';
l_stmt:='select '||
'ltc.relation_name, '||
'fk_item.column_name '||
'from '||
'edw_pvt_map_sources_md_v ltc_ru, '||
'edw_relations_md_v ltc, '||
'edw_pvt_map_key_usages_md_v fk_usage, '||
'edw_pvt_key_columns_md_v fk_isu, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_pvt_map_properties_md_v map, '||
'edw_relations_md_v tgt '||
'where '||
'tgt.relation_name=:a '||
'and map.primary_target=tgt.relation_id '||
'and ltc_ru.mapping_id=map.mapping_id '||
'and ltc.relation_id=ltc_ru.source_id '||
'and fk_usage.source_usage_id=ltc_ru.source_usage_id '||
'and fk_usage.mapping_id=map.mapping_id '||
'and fk_isu.key_id=fk_usage.foreign_key_id '||
'and fk_item.column_id=fk_isu.column_id '||
'and fk_item.parent_object_id=ltc_ru.source_id';
l_stmt:='select '||
'rel.name, '||
'fk_item.column_name '||
'from '||
'edw_tables_md_v rel, '||
'edw_foreign_keys_md_v fk, '||
'edw_pvt_key_columns_md_v fkisu, '||
'edw_pvt_columns_md_v fk_item, '||
'edw_dimensions_md_v dim, '||
'edw_levels_md_v lvl '||
'where '||
'dim.dim_name=:a '||
'and lvl.dim_id=dim.dim_id '||
'and rel.name=lvl.level_name||''_LTC'' '||
'and fk.entity_id=rel.elementid '||
'and fkisu.key_id=fk.foreign_key_id '||
'and fk_item.column_id=fkisu.column_id '||
'and fk_item.parent_object_id=rel.elementid';
l_stmt:='select release_name from fnd_product_groups';
l_stmt:='select release_name from fnd_product_groups@'||l_db_link;
l_stmt:='select '||p_col||' from '||p_table||' where rownum=1';
g_stmt:='select 1 from all_tab_columns where table_name=:1 and owner=:2 and column_name=:3';
l_stmt:='select max(last_update_date) from edw_collection_detail_log where object_name=:a';
l_stmt:='select max(last_update_date) from edw_collection_detail_log where object_name=:a '||
'and collection_status=''ERROR''';
l_stmt:='select 1 from edw_dimensions_md_v where dim_name=:a';
l_stmt:='select 1 from edw_facts_md_v where fact_name=:a';
l_stmt:='select 1 from edw_tables_md_v where name=:a';
l_stmt:='select ltc.name,lstg.name '||
'from '||
'edw_tables_md_v ltc, '||
'edw_tables_md_v lstg, '||
'edw_pvt_map_properties_md_v map, '||
'edw_dimensions_md_v dim, '||
'edw_levels_md_v lvl '||
'where dim.dim_name=:a '||
'and lvl.dim_id=dim.dim_id '||
'and ltc.name=lvl.level_name||''_LTC'' '||
'and map.primary_target(+)=ltc.elementid '||
'and lstg.elementid(+)=map.primary_source';
l_stmt:='select ltc.name,ltc.elementid '||
'from '||
'edw_levels_md_v lvl, '||
'edw_tables_md_v ltc, '||
'edw_dimensions_md_v dim '||
'where lvl.dim_id=dim.dim_id '||
'and ltc.name=lvl.level_name||''_LTC'' '||
'and dim.dim_name=:a '||
'and not exists( '||
'select 1 from '||
'edw_pvt_level_relation_md_v lvl_rel, '||
'edw_hierarchies_md_v hier '||
'where '||
'lvl_rel.hierarchy_id=hier.hier_id '||
'and hier.dim_id=dim.dim_id '||
'and lvl_rel.parent_level_id=lvl.level_id) ';
l_stmt:='select ltc.name '||
'from '||
'edw_levels_md_v lvl, '||
'edw_tables_md_v ltc, '||
'edw_dimensions_md_v dim '||
'where lvl.dim_id=dim.dim_id '||
'and ltc.name=lvl.level_name||''_LTC'' '||
'and dim.dim_name=:a '||
'and not exists( '||
'select 1 from '||
'edw_pvt_level_relation_md_v lvl_rel, '||
'edw_hierarchies_md_v hier '||
'where '||
'lvl_rel.hierarchy_id=hier.hier_id '||
'and hier.dim_id=dim.dim_id '||
'and lvl_rel.parent_level_id=lvl.level_id) ';
l_stmt:='select dim.dim_name,ltc.elementid,ltc.name '||
'from '||
'edw_levels_md_v lvl, '||
'edw_tables_md_v ltc, '||
'edw_dimensions_md_v dim '||
'where lvl.dim_id=dim.dim_id '||
'and ltc.name=lvl.level_name||''_LTC'' ';
'select 1 from '||
'edw_pvt_level_relation_md_v lvl_rel, '||
'edw_hierarchies_md_v hier '||
'where '||
'lvl_rel.hierarchy_id=hier.hier_id '||
'and hier.dim_id=dim.dim_id '||
'and lvl_rel.parent_level_id=lvl.level_id) ';
l_stmt:='select profile_option_name from fnd_profile_options'||l_db_link_stmt||' where profile_option_name '||
' like '''||p_parent_table_name||'_PS%''';
l_stmt:='select fnd_profile.value'||l_db_link_stmt||'('''||l_profile_options(i)||''') from dual';
l_stmt:='select B.profile_option_value from fnd_profile_options'||l_db_link_stmt||' A, '||
'fnd_profile_option_values'||l_db_link_stmt||' B '||
'where A.profile_option_id=B.profile_option_id '||
'and A.profile_option_name=:a';
l_stmt:='select warehouse_to_instance_link from edw_source_instances where instance_code=:a';
l_stmt:='select sysdate from dual@'||p_db_link;
l_stmt:='select pk_item.column_name '||
'from '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v isu, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
'pk.entity_id=:a '||
'and pk.primarykey=1 '||
'and isu.key_id=pk.key_id '||
'and pk_item.column_id=isu.column_id '||
'and pk_item.parent_object_id=pk.entity_id';
l_stmt:='select '||
'lvl.level_prefix||''_''||pk_item.column_name '||
'from '||
'edw_tables_md_v rel, '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v isu, '||
'edw_pvt_columns_md_v pk_item, '||
'edw_levels_md_v lvl '||
'where '||
' lvl.dim_id=:a '||
'and rel.name=lvl.level_name||''_LTC'' '||
'and pk.entity_id=rel.elementid '||
'and isu.key_id=pk.key_id '||
'and pk_item.column_id=isu.column_id '||
'and pk_item.data_type=''NUMBER'' '||
'and pk_item.parent_object_id=rel.elementid';
l_stmt:='select '||
'lvl.level_prefix||''_NAME'' '||
'from '||
'edw_levels_md_v lvl '||
'where '||
' lvl.dim_id=:a ';
l_stmt:='select '||
'sec_relation.sequence_name '||
'from '||
'edw_pvt_map_sources_md_v sec_relation_usage, '||
'edw_pvt_sequences_md_v sec_relation, '||
'edw_pvt_map_properties_md_v map '||
'where '||
'map.primary_target=:a '||
'and sec_relation_usage.mapping_id=map.mapping_id '||
'and sec_relation.sequence_id=sec_relation_usage.source_id';
l_stmt:='select lookup_code from fnd_common_lookups where lookup_type=:a';
l_stmt:='select pk_item.column_name '||
'from '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v isu, '||
'edw_pvt_columns_md_v pk_item '||
'where '||
'pk.entity_id=:a '||
'and isu.key_id=pk.key_id '||
'and pk_item.column_id=isu.column_id '||
'and pk_item.parent_object_id=pk.entity_id';
l_stmt:='select round(nvl(num_rows,0)) from all_tables where table_name=:a and owner=:b';
l_stmt:='select text from user_views where view_name=:a';
l_stmt:='select text from edw_pvt_map_properties_md_v where mapping_id=:a and text_type=''Filter''';
l_stmt:='select '||
'parent_ltc.name, '||
'parent_ltc.elementid, '||
'child_ltc.name, '||
'child_ltc.elementid, '||
'hier.HIER_NAME '||
'from '||
'edw_pvt_level_relation_md_v lvl_rel, '||
'edw_hierarchies_md_v hier, '||
'edw_dimensions_md_v dim, '||
'edw_levels_md_v child_level, '||
'edw_levels_md_v parent_level, '||
'edw_tables_md_v parent_ltc, '||
'edw_tables_md_v child_ltc '||
'where '||
'dim.dim_name=:a '||
'and hier.DIM_ID=dim.DIM_ID '||
'and lvl_rel.HIERARCHY_ID=hier.HIER_ID '||
'and child_level.LEVEL_ID=lvl_rel.CHILD_LEVEL_ID '||
'and parent_level.LEVEL_ID=lvl_rel.PARENT_LEVEL_ID '||
'and parent_ltc.name=parent_level.LEVEL_NAME||''_LTC'' '||
'and child_ltc.name=child_level.LEVEL_NAME||''_LTC'' ';
l_stmt:='select mapping_id from edw_pvt_map_properties_md_v where primary_target=:a';
l_stmt:='select map.mapping_id from edw_pvt_map_properties_md_v map,edw_relations_md_v rel where '||
'rel.relation_name=:a and map.primary_target=rel.relation_id ';
l_stmt:='select last_analyzed from all_tables where table_name=:1 and owner=:2';
p_update_type varchar2,
p_mode varchar2,
p_explain_plan_check boolean,
p_fact_dlog varchar2,
p_key_set number,
p_instance_type varchar2,
p_load_pk number,
p_skip_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_number_skip_cols number,
p_fresh_restart boolean,
p_op_table_space varchar2,
p_da_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_number_da_cols number,
p_da_table varchar2,
p_pp_table varchar2,
p_master_instance varchar2,
p_rollback varchar2,
p_skip_levels EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_number_skip_levels number,
p_smart_update boolean,
p_fk_use_nl number,
p_fact_smart_update number,
p_auto_dang_table_extn varchar2,
p_log_dang_keys boolean,
p_create_parent_table_records boolean,
p_smart_update_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_number_smart_update_cols number,
p_check_fk_change boolean,
p_stg_join_nl_percentage number,
p_ok_switch_update number,
p_stg_make_copy_percentage number,
p_ok_table varchar2,
p_hash_area_size number,
p_sort_area_size number,
p_trace boolean,
p_read_cfig_options boolean,
p_job_status_table varchar2,
p_max_round number,
p_update_dlog_lookup_table varchar2,
p_dlog_has_data boolean,
p_sleep_time number,
p_parallel_drill_down boolean
) return boolean is
l_fact_audit varchar2(2);
l_smart_update varchar2(2);
l_smart_update_table varchar2(80);
l_smart_update_table:=p_table_name||'_SU';
if drop_table(l_smart_update_table)=false then
null;
'update_type varchar2(80),'||
'p_mode varchar2(80),'||
'explain_plan_check varchar2(2),'||
'fact_dlog varchar2(80),'||
'key_set number,'||
'instance_type varchar2(80),'||
'load_pk number,'||
'fresh_restart varchar2(2),'||
'op_table_space varchar2(80),'||
'da_table varchar2(80),'||
'pp_table varchar2(80),'||
'master_instance varchar2(80),'||
'rollback varchar2(80),'||
'smart_update varchar2(2),'||
'fk_use_nl number,'||
'fact_smart_update number,'||
'auto_dang_table_extn varchar2(80),'||
'log_dang_keys varchar2(2),'||
'create_parent_table_records varchar2(2),'||
'check_fk_change varchar2(2),'||
'stg_join_nl_percentage number,'||
'ok_switch_update number,'||
'stg_make_copy_percentage number,'||
'ok_table varchar2(80),'||
'hash_area_size number,'||
'sort_area_size number,'||
'trace_mode varchar2(2),'||
'read_cfig_options varchar2(2),'||
'job_status_table varchar2(80),'||
'max_round number,'||
'update_dlog_lookup_table varchar2(80),'||
'dlog_has_data varchar2(2),'||
'total_records number,'||
'stg_copy_table_flag varchar2(10),'||
'sleep_time number,'||
'parallel_drill_down varchar2(10)'||
') tablespace '||p_op_table_space;
l_smart_update:='N';
if p_smart_update then
l_smart_update:='Y';
g_stmt:='insert into '||p_table_name||'('||
'object_name,'||
'mapping_id,'||
'map_type,'||
'primary_src ,'||
'primary_target ,'||
'primary_target_name,'||
'object_type,'||
'conc_id ,'||
'conc_program_name,'||
'fact_audit,'||
'net_change,'||
'fact_audit_name,'||
'net_change_name,'||
'fact_audit_is_name,'||
'net_change_is_name,'||
'debug,'||
'duplicate_collect,'||
'execute_flag,'||
'request_id ,'||
'collection_size ,'||
'parallel ,'||
'table_owner,'||
'bis_owner ,'||
'temp_log,'||
'forall_size ,'||
'update_type,'||
'p_mode,'||
'explain_plan_check,'||
'fact_dlog,'||
'key_set ,'||
'instance_type,'||
'load_pk ,'||
'fresh_restart,'||
'op_table_space,'||
'da_table,'||
'pp_table,'||
'master_instance,'||
'rollback,'||
'smart_update,'||
'fk_use_nl ,'||
'fact_smart_update ,'||
'auto_dang_table_extn,'||
'log_dang_keys,'||
'create_parent_table_records,'||
'check_fk_change,'||
'stg_join_nl_percentage ,'||
'ok_switch_update ,'||
'stg_make_copy_percentage,'||
'ok_table, '||
'hash_area_size,'||
'sort_area_size,'||
'trace_mode,'||
'read_cfig_options, '||
'job_status_table, '||
'max_round,'||
'update_dlog_lookup_table,'||
'dlog_has_data,'||
'sleep_time,'||
'parallel_drill_down'||
') values ('||
':1,:2,:3,:4,:5,:6,:7,:8,:9,:10,'||
':11,:12,:13,:14,:15,:16,:17,:18,:19,:20,'||
':21,:22,:23,:24,:25,:26,:27,:28,:29,:30,'||
':31,:32,:33,:34,:35,:36,:37,:38,:39,:40,'||
':41,:42,:43,:44,:45,:46,:47,:48,:49,:50,'||
':51,:52,:53,:54,:55,:56,:57,:58,:59)';
p_update_type ,
p_mode ,
l_explain_plan_check ,
p_fact_dlog ,
p_key_set ,
p_instance_type ,
p_load_pk ,
l_fresh_restart ,
p_op_table_space ,
p_da_table ,
p_pp_table ,
p_master_instance ,
p_rollback ,
l_smart_update ,
p_fk_use_nl ,
p_fact_smart_update ,
p_auto_dang_table_extn ,
l_log_dang_keys ,
l_create_parent_table_records ,
l_check_fk_change ,
p_stg_join_nl_percentage ,
p_ok_switch_update ,
p_stg_make_copy_percentage,
p_ok_table,
p_hash_area_size,
p_sort_area_size,
l_trace,
l_read_cfig_options,
p_job_status_table,
p_max_round,
p_update_dlog_lookup_table,
l_dlog_has_data,
p_sleep_time,
l_parallel_drill_down;
g_stmt:='insert into '||l_skip_cols_table||'(col_name) values(:1)';
g_stmt:='insert into '||l_skip_levels_table||'(col_name) values(:1)';
g_stmt:='create table '||l_smart_update_table||'('||
'col_name varchar2(80)) tablespace '||p_op_table_space;
if p_number_smart_update_cols>0 then
g_stmt:='insert into '||l_smart_update_table||'(col_name) values(:1)';
for i in 1..p_number_smart_update_cols loop
execute immediate g_stmt using p_smart_update_cols(i);
g_stmt:='insert into '||l_da_cols_table||'(col_name) values(:1)';
g_stmt:='insert into '||p_da_cols_table||'(col_name,stg_col_name) values(:1,:2)';
function update_load_input_table(
p_table_name varchar2,
p_ok_table varchar2,
p_max_round number,
p_update_dlog_lookup_table varchar2,
p_dlog_has_data boolean,
p_total_records number,
p_stg_copy_table_flag boolean
)return boolean is
l_dlog_has_data varchar2(10);
write_to_log_file_n('In update_load_input_table ');
g_stmt:='update '||p_table_name||' set ok_table=:1,max_round=:2,update_dlog_lookup_table=:3,dlog_has_data=:4,'||
'total_records=:5,stg_copy_table_flag=:6';
p_update_dlog_lookup_table||' '||l_dlog_has_data||' '||p_total_records||' '||l_stg_copy_table_flag);
execute immediate g_stmt using p_ok_table,p_max_round,p_update_dlog_lookup_table,l_dlog_has_data,
p_total_records,l_stg_copy_table_flag;
write_to_log_file_n('Error in update_load_input_table '||g_status_message);
g_stmt:='select 1 from all_jobs where job=:1';
g_stmt:='select total_time from all_jobs where job=:1';
g_stmt:='SELECT lock_table.SID FROM V$LOCK lock_table WHERE lock_table.TYPE=''JQ'' and lock_table.ID2=:1';
g_stmt:='select ses.SERIAL# from v$session ses where ses.SID=:1';
g_stmt:='insert into '||p_table||'(object_name,id,status,message,measure1,measure2,measure3,measure4,measure5) '||
'values(:1,:2,:3,:4,:5,:6,:7,:8,:9)';
g_stmt:='select id,job_id,status,message from '||p_job_status_table;
g_stmt:='select id,job_id,status,message from '||p_job_status_table||' where object_name=:1';
p_update_type varchar2,
p_level_order varcharTableType,
p_skip_cols varcharTableType,
p_number_skip_cols number,
p_load_pk number,
p_fresh_restart boolean,
p_op_table_space varchar2,
p_rollback varchar2,
p_ltc_merge_use_nl boolean,
p_dim_inc_refresh_derv boolean,
p_check_fk_change boolean,
p_ok_switch_update number,
p_join_nl_percentage number,
p_max_threads number,
p_min_job_load_size number,
p_sleep_time number,
p_job_status_table varchar2,
p_hash_area_size number,
p_sort_area_size number,
p_trace boolean,
p_read_cfig_options boolean,
p_max_fk_density number
) return boolean is
l_debug varchar2(2);
'update_type varchar2(200),'||
'load_pk number,'||
'fresh_restart varchar2(2),'||
'op_table_space varchar2(200),'||
'rollback varchar2(200),'||
'ltc_merge_use_nl varchar2(2),'||
'dim_inc_refresh_derv varchar2(2),'||
'check_fk_change varchar2(2),'||
'ok_switch_update number,'||
'join_nl_percentage number,'||
'max_threads number,'||
'min_job_load_size number,'||
'sleep_time number,'||
'job_status_table varchar2(200),'||
'hash_area_size number,'||
'sort_area_size number,'||
'trace varchar2(2),'||
'read_cfig_options varchar2(2),'||
'ilog_table varchar2(80),'||
'skip_ilog_update varchar2(2),'||
'level_change varchar2(2),'||
'dim_empty_flag varchar2(2),'||
'before_update_table_final varchar2(80),'||
'error_rec_flag varchar2(2),'||
'max_fk_density number'||
') tablespace '||p_op_table_space;
g_stmt:='insert into '||p_table||'('||
'conc_id, '||
'conc_name,'||
'debug,'||
'exec_flag,'||
'bis_owner,'||
'parallel,'||
'collection_size,'||
'table_owner,'||
'forall_size,'||
'update_type,'||
'load_pk,'||
'fresh_restart,'||
'op_table_space,'||
'rollback,'||
'ltc_merge_use_nl,'||
'dim_inc_refresh_derv,'||
'check_fk_change,'||
'ok_switch_update,'||
'join_nl_percentage,'||
'max_threads,'||
'min_job_load_size,'||
'sleep_time,'||
'job_status_table,'||
'hash_area_size,'||
'sort_area_size,'||
'trace,'||
'read_cfig_options,'||
'max_fk_density'||
') values ('||
':1,:2,:3,:4,:5,:6,:7,:8,:9,:10,'||
':11,:12,:13,:14,:15,:16,:17,:18,:19,:20,'||
':21,:22,:23,:24,:25,:26,:27,:28'||
')';
write_to_log_file('p_update_type='||p_update_type);
write_to_log_file('p_ok_switch_update='||p_ok_switch_update);
p_update_type,
p_load_pk,
l_fresh_restart,
p_op_table_space,
p_rollback,
l_ltc_merge_use_nl,
l_dim_inc_refresh_derv,
l_check_fk_change,
p_ok_switch_update,
p_join_nl_percentage,
p_max_threads,
p_min_job_load_size,
p_sleep_time,
p_job_status_table,
p_hash_area_size,
p_sort_area_size,
l_trace,
l_read_cfig_options,
p_max_fk_density;
g_stmt:='insert into '||l_level_table||'('||
'level_number,'||
'levels,'||
'child_level_number,'||
'level_snapshot_logs,'||
'level_order'||
') values('||
':1,:2,:3,:4,:5'||
')';
g_stmt:='insert into '||l_level_child_table||'('||
'run_number,'||
'child_levels,'||
'child_fk,'||
'parent_pk'||
') values('||
':1,:2,:3,:4'||
')';
g_stmt:='insert into '||l_skip_table||'('||
'skip_cols'||
') values('||
':1'||
')';
function update_dim_load_input_table(
p_input_table varchar2,
p_ilog_table varchar2,
p_skip_ilog_update boolean,
p_level_change boolean,
p_dim_empty_flag boolean,
p_before_update_table_final varchar2,
p_error_rec_flag boolean,
p_consider_snapshot booleanTableType,
p_levels_I varcharTableType,
p_use_ltc_ilog booleanTableType,
p_number_levels number
)return boolean is
l_skip_ilog_update varchar2(2);
write_to_log_file_n('In update_dim_load_input_table');
l_skip_ilog_update:='N';
if p_skip_ilog_update then
l_skip_ilog_update:='Y';
g_stmt:='update '||p_input_table||' set ilog_table=:1,skip_ilog_update=:2,level_change=:3,'||
'dim_empty_flag=:4,before_update_table_final=:5,error_rec_flag=:6';
execute immediate g_stmt using p_ilog_table,l_skip_ilog_update,l_level_change,l_dim_empty_flag,
p_before_update_table_final,l_error_rec_flag;
g_stmt:='update '||l_level_table||' set consider_snapshot=:1,levels_I=:2,use_ltc_ilog=:3 where level_number=:4';
write_to_log_file_n('Error in update_dim_load_input_table '||g_status_message);
p_update_type varchar2,
p_fact_dlog varchar2,
p_skip_cols varcharTableType,
p_number_skip_cols number,
p_load_fk number,
p_fresh_restart boolean,
p_op_table_space varchar2,
p_bu_tables varcharTableType,--before update tables.prop dim change to derv
p_bu_dimensions varcharTableType,
p_number_bu_tables number,
p_bu_src_fact varchar2,--what table to look at as the src fact. if null, scan full the src fact
p_load_mode varchar2,
p_rollback varchar2,
p_src_join_nl_percentage number,
p_max_threads number,
p_min_job_load_size number,
p_sleep_time number,
p_job_status_table varchar2,
p_hash_area_size number,
p_sort_area_size number,
p_trace boolean,
p_read_cfig_options boolean
) return boolean is
l_fk_table varchar2(80);
'update_type varchar2(80),'||
'fact_dlog varchar2(80),'||
'load_fk number,'||
'fresh_restart varchar2(2),'||
'op_table_space varchar2(80),'||
'bu_src_fact varchar2(80),'||
'load_mode varchar2(80),'||
'rollback varchar2(80),'||
'src_join_nl_percentage number,'||
'max_threads number,'||
'min_job_load_size number,'||
'sleep_time number,'||
'job_status_table varchar2(80),'||
'hash_area_size number,'||
'sort_area_size number,'||
'trace varchar2(2),'||
'read_cfig_options varchar2(2),'||
'ilog_table varchar2(80),'||
'dlog_table varchar2(80),'||
'skip_ilog_update varchar2(2),'||
'skip_dlog_update varchar2(2),'||
'skip_ilog varchar2(2),'||
'src_object_ilog varchar2(80),'||
'src_object_dlog varchar2(80),'||
'src_snplog_has_pk varchar2(2),'||
'err_rec_flag varchar2(2),'||
'err_rec_flag_d varchar2(2),'||
'dbms_job_id number '||
') tablespace '||p_op_table_space;
g_stmt:='insert into '||p_input_table||'('||
'fact_id,'||
'mapping_id,'||
'src_object,'||
'src_object_id,'||
'conc_id,'||
'conc_program_name,'||
'debug,'||
'collection_size,'||
'parallel,'||
'bis_owner,'||
'table_owner ,'||
'full_refresh,'||
'forall_size,'||
'update_type,'||
'fact_dlog,'||
'load_fk,'||
'fresh_restart,'||
'op_table_space,'||
'bu_src_fact,'||
'load_mode,'||
'rollback,'||
'src_join_nl_percentage,'||
'max_threads,'||
'min_job_load_size,'||
'sleep_time,'||
'job_status_table,'||
'hash_area_size,'||
'sort_area_size,'||
'trace,'||
'read_cfig_options'||
') values('||
':1,:2,:3,:4,:5,:6,:7,:8,:9,:10,'||
':11,:12,:13,:14,:15,:16,:17,:18,:19,:20,'||
':21,:22,:23,:24,:25,:26,:27,:28,:29,:30 '||
')';
p_update_type,
p_fact_dlog,
p_load_fk,
l_fresh_restart,
p_op_table_space,
p_bu_src_fact,
p_load_mode,
p_rollback,
p_src_join_nl_percentage,
p_max_threads,
p_min_job_load_size,
p_sleep_time,
p_job_status_table,
p_hash_area_size,
p_sort_area_size,
l_trace,
l_read_cfig_options;
g_stmt:='insert into '||l_fk_table||'('||
'fact_fks,'||
'higher_level,'||
'parent_dim,'||
'parent_level,'||
'level_prefix,'||
'level_pk,'||
'level_pk_key,'||
'dim_pk_key'||
') values('||
':1,:2,:3,:4,:5,:6,:7,:8'||
')';
g_stmt:='insert into '||l_skip_table||'('||
'skip_cols'||
') values('||
':1'||
')';
g_stmt:='insert into '||l_bu_table||'('||
'bu_tables,'||
'bu_dimensions'||
') values('||
':1,:2'||
')';
function update_derv_fact_input_table(
p_input_table varchar2,
p_ilog_table varchar2,
p_dlog_table varchar2,
p_skip_ilog_update boolean,
p_skip_dlog_update boolean,
p_skip_ilog boolean,
p_load_mode varchar2,
p_full_refresh boolean,
p_src_object_ilog varchar2,
p_src_object_dlog varchar2,
p_src_snplog_has_pk boolean,
p_err_rec_flag boolean,
p_err_rec_flag_d boolean
) return boolean is
l_skip_ilog_update varchar2(2);
l_skip_dlog_update varchar2(2);
write_to_log_file_n('In update_derv_fact_input_table');
l_skip_ilog_update:='N';
l_skip_dlog_update:='N';
if p_skip_ilog_update then
l_skip_ilog_update:='Y';
if p_skip_dlog_update then
l_skip_dlog_update:='Y';
g_stmt:='update '||p_input_table||' set '||
'ilog_table=:1,'||
'dlog_table=:2,'||
'skip_ilog_update=:3,'||
'skip_dlog_update=:4,'||
'skip_ilog=:5,'||
'load_mode=:6,'||
'full_refresh=:7,'||
'src_object_ilog=:8,'||
'src_object_dlog=:9,'||
'src_snplog_has_pk=:10,'||
'err_rec_flag=:11,'||
'err_rec_flag_d=:12';
l_skip_ilog_update,
l_skip_dlog_update,
l_skip_ilog,
p_load_mode,
l_full_refresh,
p_src_object_ilog,
p_src_object_dlog,
l_src_snplog_has_pk,
l_err_rec_flag,
l_err_rec_flag_d;
write_to_log_file_n('Error in update_derv_fact_input_table '||g_status_message);
g_stmt:=g_stmt||' select * from '||l_ilog_tables(i)||' union all ';
g_stmt:='select table_name from all_tables where (table_name like '''||l_search_string||'_%_'||
l_ilog_table_extn||''' or table_name like '''||l_search_string||'_%_'||l_ilog_table_extn||'A'') '||
'and owner='''||p_bis_owner||'''';
g_stmt:=g_stmt||' as select '||p_ilog_old||'.*, rownum row_num from '||p_ilog_old;
function update_inp_table_jobid(
p_input_table varchar2,
p_job_id number
)return boolean is
Begin
g_stmt:='update '||p_input_table||' set dbms_job_id=:1';
write_to_log_file_n('Error in update_inp_table_jobid '||sqlerrm||' '||get_time);
function update_inp_table_concid(
p_input_table varchar2,
p_conc_id number
)return boolean is
Begin
g_stmt:='update '||p_input_table||' set conc_id=:1';
write_to_log_file_n('Error in update_inp_table_concid '||sqlerrm||' '||get_time);
l_stmt:='select load_pk from edw_collection_detail_log where COLLECTION_STATUS=:a and object_name=:b '||
'and object_type=:c';
p_ins_rows_insert out nocopy number,
p_ins_rows_update out nocopy number,
p_ins_rows_delete out nocopy number,
p_ins_instance_name out nocopy varchar2,
p_ins_request_id_table out nocopy varchar2
) return boolean is
l_stmt varchar2(10000);
l_stmt:='select nvl(sum(nvl(rows_ready,0)),0), '||
' nvl(sum(nvl(rows_collected,0)),0), nvl(sum(nvl(rows_dangling,0)),0), '||
'nvl(sum(nvl(rows_duplicate,0)),0), nvl(sum(nvl(rows_error,0)),0),nvl(sum(nvl(number_insert,0)),0),'||
'nvl(sum(nvl(number_update,0)),0),nvl(sum(nvl(number_delete,0)),0) '||
' from edw_temp_collection_log where object_name=:a and object_type=:b and status=:c ';
l_stmt:='select nvl(sum(nvl(rows_ready,0)),0), '||
' nvl(sum(nvl(rows_collected,0)),0), nvl(sum(nvl(rows_dangling,0)),0), '||
'nvl(sum(nvl(rows_duplicate,0)),0), nvl(sum(nvl(rows_error,0)),0),nvl(sum(nvl(number_insert,0)),0),'||
'nvl(sum(nvl(number_update,0)),0),nvl(sum(nvl(number_delete,0)),0) '||
' from edw_temp_collection_log where request_id=:1';
p_ins_rows_error,p_ins_rows_insert,p_ins_rows_update,p_ins_rows_delete;
l_stmt:='select max(NUMBER_READY) from edw_temp_collection_log where object_name=:a and object_type=:b '||
'and status=:c';
'insert update delete');
p_ins_rows_duplicate||' '||p_ins_rows_error||' '||p_ins_rows_insert||' '||p_ins_rows_update
||' '||p_ins_rows_delete);
l_stmt:='delete edw_temp_collection_log where object_name=:a and object_type=:b and status=:c';
g_stmt:='select application_name from fnd_application_vl where application_short_name=:1';
p_level_full_insert booleanTableType,
p_debug boolean,
p_parallel number,
p_collection_size number,
p_bis_owner varchar2,
p_table_owner varchar2,
p_full_refresh boolean,
p_forall_size number,
p_update_type varchar2,
p_load_pk number,
p_op_table_space varchar2,
p_rollback varchar2,
p_max_threads number,
p_min_job_load_size number,
p_sleep_time number,
p_hash_area_size number,
p_sort_area_size number,
p_trace boolean,
p_read_cfig_options boolean,
p_join_nl_percentage number
) return boolean is
l_level_table varchar2(80);
l_level_full_insert varchar2(10);
'update_type varchar2(200),'||
'load_pk number,'||
'op_table_space varchar2(200),'||
'rollback varchar2(200),'||
'max_threads number,'||
'min_job_load_size number,'||
'sleep_time number,'||
'hash_area_size number,'||
'sort_area_size number,'||
'trace varchar2(10),'||
'read_cfig_options varchar2(10),'||
'join_nl_percentage number'||
') tablespace '||p_op_table_space;
g_stmt:='insert into '||p_input_table||'('||
'dim_name'||
',dim_id'||
',debug'||
',parallel'||
',collection_size'||
',bis_owner'||
',table_owner'||
',full_refresh'||
',forall_size'||
',update_type'||
',load_pk'||
',op_table_space'||
',rollback'||
',max_threads'||
',min_job_load_size'||
',sleep_time'||
',hash_area_size'||
',sort_area_size'||
',trace'||
',read_cfig_options'||
',join_nl_percentage'||
') values('||
':1,:2,:3,:4,:5,:6,:7,:8,:9,:10,'||
':11,:12,:13,:14,:15,:16,:17,:18,:19,:20,'||
':21'||
')';
p_update_type,
p_load_pk,
p_op_table_space,
p_rollback,
p_max_threads,
p_min_job_load_size,
p_sleep_time,
p_hash_area_size,
p_sort_area_size,
l_trace,
l_read_cfig_options,
p_join_nl_percentage;
'level_full_insert varchar2(10)'||
') tablespace '||p_op_table_space;
g_stmt:='insert into '||l_level_table||'('||
'level_number'||
',levels'||
',child_level_number'||
',level_order'||
',level_snapshot_logs'||
',level_ilog'||
',level_consider'||
',level_full_insert'||
') values ('||
':1,:2,:3,:4,:5,:6,:7,:8'||
')';
l_level_full_insert:='N';
if p_level_full_insert(i) then
l_level_full_insert:='Y';
,l_level_full_insert;
g_stmt:='insert into '||l_level_child_table||'('||
'run_number,'||
'child_levels,'||
'child_fk,'||
'parent_pk'||
') values('||
':1,:2,:3,:4'||
')';
g_stmt:=g_stmt||' as select ';
' as select '''||p_status||''' status,'||p_count||' count from dual';
l_stmt:='select '||p_seq||'.NEXTVAL from dual';
g_stmt:='select max('||p_col||') from '||p_table;
select
dim.relation_name,
dim.relation_id,
dim_pk_item.column_name dim_col,
fstg_item.column_name fstg_col,
fact_item.column_name fact_col
from
(select Source_usage_id,Target_column_id from edw_pvt_map_columns_md_v
where mapping_id=p_mapping_id) map_columns,
(select edw_pvt_map_key_usages_md_v.Source_usage_id,
edw_pvt_map_key_usages_md_v.Unique_key_id,
edw_pvt_map_key_usages_md_v.foreign_key_id,
edw_pvt_map_key_usages_md_v.Parent_table_usage_id
from
edw_pvt_map_key_usages_md_v,edw_pvt_map_sources_md_v
where edw_pvt_map_sources_md_v.source_usage_id=edw_pvt_map_key_usages_md_v.parent_table_usage_id
and edw_pvt_map_key_usages_md_v.Source_usage_id=p_fstg_usage_id
and edw_pvt_map_key_usages_md_v.mapping_id=p_mapping_id
and edw_pvt_map_sources_md_v.mapping_id=p_mapping_id
) key_usage,
edw_pvt_key_columns_md_v key_col,
edw_pvt_key_columns_md_v fk_key_col,
edw_unique_keys_md_v dim_pk,
edw_relations_md_v dim,
edw_pvt_columns_md_v dim_pk_item,
edw_pvt_columns_md_v fstg_item,
edw_pvt_columns_md_v fact_item
where
dim_pk.key_id=key_usage.Unique_key_id
and dim.relation_id=dim_pk.entity_id
and key_col.key_id=dim_pk.key_id
and dim_pk_item.column_id=key_col.column_id
and fk_key_col.key_id=key_usage.foreign_key_id
and fstg_item.column_id=fk_key_col.column_id
and map_columns.Source_usage_id=key_usage.Parent_table_usage_id
and map_columns.Target_column_id=fact_item.column_id ;
l_stmt := 'INSERT INTO '||l_table1||' VALUES(:1,:2,:3,:4,:5)';
' as select distinct relation_name from '||l_table1;
' as select syn.table_owner,tab.relation_name from user_synonyms syn,'||l_table2||' tab '||
'where tab.relation_name=syn.synonym_name(+)';
' as select syn.table_owner,tab.* from '||l_table3||' syn,'||l_table1||' tab '||
'where tab.relation_name=syn.relation_name';
' as select all_tab.NUM_ROWS,tab.table_owner,tab.relation_name,tab.relation_id,'||
'tab.dim_col,tab.fstg_col,tab.fact_col from '||l_table4||' tab, all_tables all_tab '||
'where all_tab.table_name=tab.relation_name and all_tab.owner=tab.table_owner '||
'and tab.table_owner is not null '||
'union all '||
'select 0,tab.table_owner,tab.relation_name,tab.relation_id,'||
'tab.dim_col,tab.fstg_col,tab.fact_col from '||l_table4||' tab where tab.table_owner is null ';
g_stmt:='select relation_name,num_rows,relation_id,dim_col,fstg_col,fact_col from '||l_table5||
' order by num_rows,relation_name';
g_stmt:='select '||
'fk_col.column_name, '||
'p_table.relation_name '||
'from '||
'edw_relations_md_v fstg, '||
'edw_foreign_keys_md_v fk, '||
'EDW_PVT_KEY_COLUMNS_MD_V fku, '||
'edw_pvt_columns_md_v fk_col, '||
'edw_relations_md_v p_table, '||
'edw_unique_keys_md_v pk '||
'where '||
'fstg.relation_id=fk.entity_id '||
'and fk.foreign_key_id=fku.key_id '||
'and fk_col.column_id=fku.column_id '||
'and fk_col.parent_object_id=fstg.relation_id '||
'and pk.key_id=fk.key_id '||
'and pk.entity_id=p_table.relation_id '||
'and fstg.relation_id=:1 ';
g_stmt:='select '||
'map_sources.source_usage_id, '||
'map_sources.source_id, '||
'src_table.name, '||
'map_targets.target_usage_id, '||
'map_targets.target_id, '||
'tgt_relation.relation_name, '||
'pk_col.column_name, '||
'tgt_column.column_name '||
'from '||
'edw_pvt_map_properties_md_v map_properties, '||
'edw_pvt_map_sources_md_v map_sources, '||
'edw_pvt_map_targets_md_v map_targets, '||
'edw_tables_md_v src_table, '||
'edw_relations_md_v tgt_relation, '||
'edw_unique_keys_md_v pk, '||
'edw_pvt_key_columns_md_v key_usage, '||
'edw_pvt_columns_md_v pk_col, '||
'(select * from edw_pvt_map_columns_md_v where mapping_id=:1) map_columns, '||
'edw_pvt_columns_md_v tgt_column '||
'where '||
'map_properties.mapping_id=:2 '||
'and map_sources.source_id=map_properties.primary_source '||
'and map_targets.target_id=map_properties.primary_target '||
'and map_sources.mapping_id=map_properties.mapping_id '||
'and src_table.elementid=map_sources.source_id '||
'and map_targets.mapping_id=map_properties.mapping_id '||
'and tgt_relation.relation_id=map_targets.target_id '||
'and pk.entity_id=map_properties.primary_source '||
'and key_usage.key_id=pk.key_id '||
'and pk_col.column_id=key_usage.column_id '||
'and map_columns.Source_usage_id=map_sources.source_usage_id '||
'and map_columns.Source_column_id=pk_col.column_id '||
'and map_columns.Target_column_id=tgt_column.column_id ';
if delete_conc_program(p_conc_short_name,p_exe_name,l_bis_long_name,'LONG')=false then
null;
function delete_conc_program(
p_conc_name varchar2,
p_exe_name varchar2,
p_bis_name varchar2,
p_name_type varchar2
) return boolean is
l_bis_long_name varchar2(400);
write_to_log_file_n('In delete_conc_program');
FND_PROGRAM.DELETE_PROGRAM(p_conc_name,l_bis_long_name);
FND_PROGRAM.DELETE_EXECUTABLE(p_exe_name,l_bis_long_name);
write_to_log_file_n('Deleted '||p_conc_name||' '||p_exe_name);
write_to_log_file_n('Error in delete_conc_program '||g_status_message);
cursor cv(p_name varchar2) is select param.value from v$parameter param where param.name=p_name;
write_to_log_file_n('select param.value from v$parameter param where param.name=:1 '||p_name);
l_stmt:='select '||p_col||' from '||p_table||' '||p_where;
l_stmt:='select ses.sid,sy.name,round(ss.value/1048576,2) from v$sesstat ss,v$sysstat sy,v$session ses '||
'where sy.statistic#=ss.statistic# and ss.sid = ses.sid and ses.audsid=:1 and '||
'sy.name in (''session pga memory'',''session pga memory max'',''session uga memory'',''session uga memory max'')';
l_stmt:='select pq.statistic,pq.last_query,pq.session_total from v$pq_sesstat pq';
select table_name from all_tables where table_name like p_pattern and owner=p_owner;
write_to_log_file_n('select table_name from all_tables where table_name like '||p_pattern||
' and owner='||p_owner);
function update_status_table(
p_table varchar2,
p_col varchar2,
p_value varchar2,
p_where varchar2
) return boolean is
--
l_stmt varchar2(4000);
l_stmt:='update '||p_table||' set '||p_col||'=:1 '||p_where;
write_to_log_file_n('Error in update_status_table '||sqlerrm);
select distinct
lvl.LEVEL_TABLE_ID,
rel.CHIL_LVLTBL_NAME,
rel.CHILD_LVLTBL_ID
from
edw_levels_md_v lvl,
edw_level_relations_md_v rel
where
lvl.LEVEL_TABLE_NAME=p_ltc
and rel.PARENT_LVL_ID(+)=lvl.level_id;
write_to_log_file_n('select distinct rel.PARENT_LVLTBL_ID,rel.CHIL_LVLTBL_NAME,rel.CHILD_LVLTBL_ID '||
'from edw_levels_md_v lvl,edw_level_relations_md_v rel where lvl.LEVEL_TABLE_NAME='||p_level_order(i)||
' and rel.PARENT_LVL_ID=lvl.level_id');
l_stmt:='insert into '||p_table||'(level_order,parent_ltc,parent_ltc_id)'||
' values(:1,:2,:3)';
l_stmt:='insert into '||p_table||'(level_order,parent_ltc,parent_ltc_id,child_ltc,child_ltc_id)'||
' values(:1,:2,:3,:4,:5)';
select PARTITIONED from all_tables where table_name=p_table and owner=p_owner;
write_to_log_file_n('select PARTITIONED from all_tables where table_name='||p_table||' and owner='||
p_owner);
select LEVEL_TABLE_ID from edw_levels_md_v where dim_id=p_dim_id;
select 1
from
ALL_MVIEWS mv,
ALL_MVIEW_DETAIL_RELATIONS rel
where
rel.mview_name=mv.mview_name
and mv.owner=rel.owner
and mv.fast_refreshable<>'NO'
and rel.detailobj_name=upper(p_object)
and rel.detailobj_owner=upper(p_owner)
and rownum=1;
write_to_log_file('select 1 from ALL_MVIEWS mv, ALL_MVIEW_DETAIL_RELATIONS rel '||
' where rel.mview_name=mv.mview_name and mv.owner=rel.owner and mv.fast_refreshable<>''NO'''||
' and rel.detailobj_name='||p_object||' and rel.detailobj_owner='||p_owner);
select table_name from all_tables where table_name like p_string and owner=p_owner;
write_to_log_file_n('In drop_tables_like, select table_name from all_tables where '||
'table_name like '||l_string||' and owner='||p_owner);
SELECT oracle_username
FROM fnd_oracle_userid WHERE oracle_id
BETWEEN 900 AND 999 AND read_only_flag = 'U';