The following lines contain the word 'select', 'insert', 'update' or 'delete':
g_last_update_date_exists boolean := false;
SELECT value_set_type type, count(*) count
FROM edw_flex_seg_mappings
WHERE dimension_short_name = dim_name
AND instance_code = edw_gen_view.g_instance
GROUP BY value_set_type;
select collection_view_name from edw_source_views
where object_name = obj_short_name
order by level_name;
g_last_update_date_exists := false;
Open cv for 'select object_type from user_objects where object_name=:s1' using l_table;
Open cv for 'select table_name from user_synonyms where synonym_name=:s1' using l_table;
stmt := 'SELECT distinct column_name FROM all_tab_columns@'||edw_gen_view.g_source_db_link
||' WHERE column_name in( ''LAST_UPDATE_DATE'', ''CREATION_DATE'', ''DESCRIPTION'' )'
||' and table_name = :table_name ';
IF (l_column = 'LAST_UPDATE_DATE') THEN
g_last_update_date_exists := true;
stmt1 := 'SELECT distinct APPLICATION_TABLE_NAME, value_set_id, value_column_name, meaning_column_name,
id_column_name, value_set_name FROM edw_flex_seg_mappings a,'||
' fnd_flex_validation_tables@' ||edw_gen_view.g_source_db_link
||' b WHERE a.value_set_id = b.flex_value_set_id '
||' AND a.dimension_short_name = :d1 AND A.VALUE_SET_TYPE = :d2';
stmt2 := 'SELECT DISTINCT ''SELECT ''||''''''''|| a.instance_code ||'':''||a.value_set_id||'':''''''||''||''|| value_column_name ||'' L2_PK,
''|| VALUE_COLUMN_NAME|| '' actual_value,
'' ||''''''';
stmt2 := 'SELECT DISTINCT ''SELECT ''||''''''''|| a.instance_code ||'':''||a.value_set_id||'':''''''||''||''|| id_column_name ||'' L2_PK,
''|| id_COLUMN_NAME|| '' actual_value,'' ||''''''';
stmt2 := 'SELECT DISTINCT ''SELECT ''||''''''''|| a.instance_code ||'':''||a.value_set_id||'':''''''||''||''|| id_column_name ||'' L2_PK,
''|| value_COLUMN_NAME|| '' actual_value,
'' ||''''''';
IF (g_last_update_date_exists) THEN
edw_gen_view.writelog('Last Update date exists');
stmt2 := stmt2||' '||l_table_alias||'.last_update_date ';
stmt2 := stmt2||' '||l_final_table||'.last_update_date ';
stmt2 := stmt2 || ' last_update_date, ';
stmt2 := stmt2 || ' to_date(null, ''''mm/dd/yyyy hh24:mi:ss'''') last_update_date, ';
edw_gen_view.g_where_clause.delete;
edw_gen_view.writelog('Select Clause IS : '|| clause);
SELECT distinct a.value_set_type, a.value_set_id, a.parent_value_set_id
FROM edw_flex_seg_mappings a
WHERE
dimension_short_name = p_dim_name
and instance_code = edw_gen_view.g_instance
AND ( value_set_type = 'I' /* OR value_set_type = 'N' OR
value_set_type = 'F' */)
AND NOT EXISTS
(SELECT 1 FROM edw_flex_seg_mappings b
where b.parent_value_set_id = a.value_set_id
AND b.dimension_short_name = a.dimension_short_name
AND b.structure_num = a.structure_num);
SELECT parent.value_set_type, parent.value_set_id, parent.parent_value_set_id , parent.structure_num
FROM edw_flex_seg_mappings parent, edw_flex_seg_mappings child
WHERE
parent.dimension_short_name = child.dimension_short_name
AND parent.dimension_short_name = p_dim_name
AND parent.instance_code = edw_gen_view.g_instance
AND child.instance_code = edw_gen_view.g_instance
AND parent.value_set_type = 'I'
AND child.value_set_type = 'D'
AND child.parent_value_set_id = parent.value_set_id
AND parent.structure_num = child.structure_num;
src_view := 'SELECT '||''''||edw_gen_view.g_instance||':''||'||'flex_value_set_id||'':''||flex_value L2_PK, flex_value actual_value, ' ||newline||
' '''||edw_gen_view.g_instance||''''||' instance, last_update_date, '||
newline||' creation_date, description, ''NA_EDW'' L2_FK '||
newline||' FROM fnd_flex_values_vl '||
newline||' WHERE flex_value_set_id IN ( ';
src_view := 'SELECT '||''''||edw_gen_view.g_instance||':''||'||'a.flex_value_set_id||'':''||a.flex_value L1_PK, ' ||newline||
' flex_value actual_value, '||
''''||edw_gen_view.g_instance||''''||' instance, '||newline||
' a.last_update_date, a.creation_date, a.description, ''NA_EDW'' L1_FK '||
newline||' FROM fnd_flex_values_vl a ' ||
' WHERE a.flex_value_set_id IN ( ';
SELECT distinct a.value_set_type, a.value_set_id, a.parent_value_set_id
FROM edw_flex_seg_mappings a WHERE
dimension_short_name = p_dim_name
and a.instance_code = edw_gen_view.g_instance
AND a.parent_value_set_id <> 0 ; /* dependant value sets */
src_view := ' SELECT '||''''||edw_gen_view.g_instance||':''||'||' childvl.flex_value_set_id||'':''||parentvl.flex_value|| '':''|| childvl.flex_value L2_PK, parentvl.flex_value||'':''||childvl.flex_value actual_value,';
newline||' childvl.last_update_date, childvl.creation_date, '||
newline||' childvl.description, '||''''||edw_gen_view.g_instance||':''||'||' parentvl.flex_value_set_id '|| '||'':''||'||' parentvl.flex_value L2_FK ';
select1 varchar2(1000);
select2 varchar2(1000);
select3 varchar2(1000);
select4 varchar2(1000);
select1 := 'SELECT b.APPLICATION_TABLE_NAME , a.structure_num, a.STRUCTURE_NAME,'||newline;
finalStmt := select1||whereKeyFlex||'UNION ALL ' ||newline||select1 ||whereDescFlex;
select1 := 'SELECT ''SELECT DISTINCT ''||''''''''|| a.instance_code ||'':''||a.value_set_id||'':''''||''||application_column_name ||'' L2_PK, '''||newline;
select2 := '|| application_COLUMN_NAME ||'' ACTUAL_VALUE,'' ||''''''''||a.instance_code||''''''''||';
select3 := ''' INSTANCE, ';
IF (g_last_update_date_exists) THEN
select3 := select3 || newline||' LAST_UPDATE_DATE, ';
select3 := select3 || newline||' to_date(null, ''''mm/dd/yyyy hh24:mi:ss'''') last_update_date, ';
select3 := select3 || newline||' CREATION_DATE, ';
select3 := select3 || newline||' to_date(null, ''''mm/dd/yyyy hh24:mi:ss'''') creation_date, ';
select3 := select3 || newline||' DESCRIPTION, ';
select3 := select3 || newline||' null DESCRIPTION, ';
select3 := select3 ||'''''NA_EDW'''' L2_FK FROM ''';
select4 := ' || b.APPLICATION_TABLE_NAME||'' WHERE ''||application_column_name ||'' is not null ';
select4 := select4 ||' AND '||l_structure_col || ' = '''''||l_structure_id ||'''''';
select4 := select4 ||' AND '||l_structure_col || ' = '''''||l_structure_id ||'''''';
select4 := select4 ||' AND '||l_structure_col || ' = '''''|| l_struct_name ||'''''';
select4 := select4||''' FROM edw_flex_seg_mappings a, '||newline;
finalStmt := select1||select2||select3||select4||whereKeyFlex||' UNION ALL ' ||newline||
select1||select2||select3||select4||whereDescFlex;
SELECT flex_view_name, generated_view_name, collection_view_name
INTO g_std_flex_view_name, g_std_generated_view_name, g_std_collection_view_name
FROM edw_source_views
WHERE object_name = dim_name AND level_name = level AND version =edw_gen_view.g_version;
SELECT generated_view_name INTO view_name
FROM edw_source_views
WHERE object_name = dim_name AND level_name = level AND version =edw_gen_view.g_version;
select attribute_name, attribute_type
from edw_attribute_properties
where skip_flag = 'Y'
and object_short_name = p_object_short_name
and level_name = p_level_name;
stmt := 'SELECT distinct column_name, data_type FROM all_tab_columns@'||edw_gen_view.g_source_db_link;
srcview := ' CREATE OR REPLACE FORCE VIEW ' ||view_name || ' AS '||newline|| 'SELECT ';
srcview := replace (srcview, 'SELECT ', 'SELECT '||newline);
SELECT DISTINCT level_name FROM edw_attribute_mappings
WHERE object_short_name = dim_name;
selectClause VARCHAR2(32000) := null;
select value_set_type, value_set_id, parent_value_set_id
from edw_flex_seg_mappings where
dimension_short_name = obj_name
and instance_code = edw_gen_view.g_instance
order by value_set_type;
selectClause := getDepVSClause(dim_name);
selectClause := selectClause || newline||'UNION ALL '||newline;
selectClause := selectClause || getTableValClause(dim_name);
selectClause := selectClause || newline||'UNION ALL '||newline;
selectClause := selectClause||getIndepVSClause(dim_name, 'LOWER');
selectClause := selectClause ||newline|| 'UNION ALL '||newline;
selectClause := selectClause||getNoneVSClause(dim_name);
src_view := src_view || selectClause;
src_view := replace (src_view, 'SELECT ', 'SELECT '||newline);
src_view := 'CREATE OR REPLACE FORCE VIEW '||flexdim_viewname1 || ' as '||newline||'SELECT ''NA_EDW'' L1_PK, ''NA_EDW'' L1_FK, '||
''''||edw_gen_view.g_instance||''''||' instance, null actual_value, '||newline||
' null last_update_date, null description, null creation_date from dual where 1=2';