35: dmp_g_dimensions(g_dimensions);
36: end if;
37: implement_dim_aw(g_dimensions,p_affected_kpi);
38: if g_debug then
39: log_n('create_dim complete '||bsc_aw_utility.get_time);
40: end if;
41: Exception when others then
42: log_n('Exception in create_dim '||sqlerrm);
43: raise;
53: p_dim_levels out nocopy levels_tv
54: ) is
55: Begin
56: if g_debug then
57: log_n('In get_all_dim_levels'||bsc_aw_utility.get_time);
58: end if;
59: --get all the parent child relations for the levels
60: bsc_aw_bsc_metadata.get_all_parent_child(p_dim_level_list,p_dim_parent_child,p_dim_levels);
61: if g_debug then
114: p_level varchar2,
115: p_set number
116: ) is
117: Begin
118: if bsc_aw_utility.in_array(p_level_considered,p_level) then
119: return;
120: end if;
121: for i in 1..p_dim_parent_child.count loop
122: if p_dim_parent_child(i).child_level=p_level then
180: -- the issue here was we had level values and parent child values retained from the previous
181: -- kpi run p_dimensions... which was causing problem
182: --- this will clear the previous entries from the structure
183: l_dim.level_groups.delete;
184: bsc_aw_utility.delete_table('bsc_aw_temp_vn',null);
185: for j in 1..p_dim_parent_child.count loop
186: if p_dim_parent_child(j).level_set=i then
187: l_level:=p_dim_parent_child(j).child_level;
188: l_id:=p_dim_levels(l_level).level_id;
250: l_hash_string:=l_hash_string||'.'||p_dimension.level_groups(i).levels(j).level_id;
251: end loop;
252: end loop;
253: --add the time to make it unique
254: l_hash_string:=l_hash_string||'.'||bsc_aw_utility.get_dbms_time;
255: return l_hash_string;
256: Exception when others then
257: log_n('Exception in get_dim_name_hash_string '||sqlerrm);
258: raise;
261: procedure make_dim_name(p_dimension in out nocopy dimension_r,p_hash_string varchar2) is
262: l_hash_value varchar2(200);
263: Begin
264: p_dimension.dim_name:='BSC_CC';
265: l_hash_value:=bsc_aw_utility.get_hash_value(p_hash_string,100,1073741824);
266: p_dimension.dim_name:=p_dimension.dim_name||'_'||l_hash_value;
267: Exception when others then
268: log_n('Exception in make_dim_name '||sqlerrm);
269: raise;
283: p_dim.property:=p_dim.property||'normal hier,';
284: --also the denorm source, child col and parent col. we need it in the load dim module to load
285: --norm hier into bsc_aw_temp_pc
286: --note>>>the denorm_data_source is like (select a,b from CC). it has comma inside. if in bscawldb.pls, we try
287: --to bsc_aw_utility.get_parameter_value(l_dim_property,'denorm source',','), we will get (select a since the stmt
288: --is cutoff at the first , so we will replace the , with *^ and later, in bscawldb.pls, replace the *^ with ,
289: --note>>>p_dim.level_groups(1).data_source.data_source and p_dim.level_groups(1).data_source.denorm_data_source go together
290: if p_dim.level_groups(1).data_source.data_source is not null then
291: p_dim.property:=p_dim.property||'denorm source='||replace(p_dim.level_groups(1).data_source.denorm_data_source,',','*^')||',';
581: l_recreate_option:='RECREATE STD DIM';
582: else
583: l_recreate_option:='RECREATE DIM';
584: end if;
585: if bsc_aw_utility.get_parameter_value(bsc_aw_utility.g_options,l_recreate_option)='Y' then
586: if g_debug then
587: log('Dim needs to be force recreated');
588: end if;
589: l_dim_create:='create all';
586: if g_debug then
587: log('Dim needs to be force recreated');
588: end if;
589: l_dim_create:='create all';
590: elsif bsc_aw_utility.get_parameter_value(bsc_aw_utility.g_options,'RECREATE PROGRAM')='Y' then
591: if g_debug then
592: log('Dim needs to be force recreated');
593: end if;
594: l_dim_create:='create all';
617: --
618: Begin
619: --get_kpi_for_dim gives the list of kpi already implemented in AW for this dim
620: bsc_aw_md_api.get_kpi_for_dim(p_dim_name,l_kpi_list);
621: bsc_aw_utility.merge_array(p_affected_kpi,l_kpi_list);
622: for i in 1..l_kpi_list.count loop
623: bsc_aw_adapter_kpi.drop_kpi_objects(l_kpi_list(i));
624: bsc_aw_md_api.mark_kpi_recreate(l_kpi_list(i));
625: end loop;
656: end if;
657: end loop;
658: for i in 1..l_objects.count loop
659: if l_flag(i)='N' and (l_objects(i).olap_object_type='relation' or l_objects(i).olap_object_type='variable') then
660: bsc_aw_utility.delete_aw_object(l_objects(i).object);
661: l_flag(i):='Y';
662: end if;
663: end loop;
664: for i in 1..l_objects.count loop
662: end if;
663: end loop;
664: for i in 1..l_objects.count loop
665: if l_flag(i)='N' and l_objects(i).object_type='concat dimension' then
666: bsc_aw_utility.delete_aw_object(l_objects(i).object);
667: l_flag(i):='Y';
668: end if;
669: end loop;
670: for i in 1..l_objects.count loop
668: end if;
669: end loop;
670: for i in 1..l_objects.count loop
671: if l_flag(i)='N' and l_objects(i).object_type='dimension' then
672: bsc_aw_utility.delete_aw_object(l_objects(i).object);
673: l_flag(i):='Y';
674: end if;
675: end loop;
676: for i in 1..l_objects.count loop
674: end if;
675: end loop;
676: for i in 1..l_objects.count loop
677: if l_flag(i)='N' then
678: bsc_aw_utility.delete_aw_object(l_objects(i).object);
679: l_flag(i):='Y';
680: end if;
681: end loop;
682: bsc_aw_md_api.drop_dim(p_dim_name);--this will delete all child objects in metadata
726: create inc refresh program
727: */
728: procedure create_dim_objects(p_dimension in out nocopy dimension_r) is
729: Begin
730: bsc_aw_utility.add_sqlerror(-34340,'ignore',null);
731: bsc_aw_utility.add_sqlerror(-36656,'ignore',null);
732: --all info to create a dim should be in p_dimension
733: create_dim_for_levels(p_dimension);
734: --if there is only 1 level and this level=dim name then we dont create cc dim or relations
727: */
728: procedure create_dim_objects(p_dimension in out nocopy dimension_r) is
729: Begin
730: bsc_aw_utility.add_sqlerror(-34340,'ignore',null);
731: bsc_aw_utility.add_sqlerror(-36656,'ignore',null);
732: --all info to create a dim should be in p_dimension
733: create_dim_for_levels(p_dimension);
734: --if there is only 1 level and this level=dim name then we dont create cc dim or relations
735: --this is true for TYPE and PROJECTION dim
743: -- calling this api here will fill the correct values in property attribute
744: -- including level name dim
745: set_dim_properties(p_dimension);
746: bsc_aw_md_api.create_dim_objects(p_dimension);
747: bsc_aw_utility.remove_sqlerror(-34340,'ignore');
748: bsc_aw_utility.remove_sqlerror(-36656,'ignore');
749: Exception when others then
750: log_n('Exception in create_dim_objects '||sqlerrm);
751: raise;
744: -- including level name dim
745: set_dim_properties(p_dimension);
746: bsc_aw_md_api.create_dim_objects(p_dimension);
747: bsc_aw_utility.remove_sqlerror(-34340,'ignore');
748: bsc_aw_utility.remove_sqlerror(-36656,'ignore');
749: Exception when others then
750: log_n('Exception in create_dim_objects '||sqlerrm);
751: raise;
752: End;
963: else
964: l_pgm:=p_dimension.inc_load_program;
965: end if;
966: if l_pgm is not null then
967: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
968: bsc_aw_utility.add_g_commands(g_commands,'allstat');
969: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
970: for i in 1..p_dimension.level_groups.count loop
971: create_dim_program(p_dimension,p_dimension.level_groups(i),p_mode);
964: l_pgm:=p_dimension.inc_load_program;
965: end if;
966: if l_pgm is not null then
967: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
968: bsc_aw_utility.add_g_commands(g_commands,'allstat');
969: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
970: for i in 1..p_dimension.level_groups.count loop
971: create_dim_program(p_dimension,p_dimension.level_groups(i),p_mode);
972: end loop;
965: end if;
966: if l_pgm is not null then
967: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
968: bsc_aw_utility.add_g_commands(g_commands,'allstat');
969: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
970: for i in 1..p_dimension.level_groups.count loop
971: create_dim_program(p_dimension,p_dimension.level_groups(i),p_mode);
972: end loop;
973: --base value
972: end loop;
973: --base value
974: --base value cubes will be used in the olap table functions for the kpi
975: if p_dimension.base_value_cube is not null then
976: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
977: end if;
978: --
979: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
980: end if;
975: if p_dimension.base_value_cube is not null then
976: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
977: end if;
978: --
979: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
980: end if;
981: Exception when others then
982: log_n('Exception in create_dim_program '||sqlerrm);
983: raise;
991: l_snowflake_levels levels_tb;
992: Begin
993: --if p_level_group.data_source.data_source is not null, then p_level_group.data_source.inc_data_source is also not null
994: if p_level_group.data_source.data_source is not null then
995: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
996: --this is where we cannot assume that the data source has the same name as the levels.
997: --this is for DBI dimensions (non rec)
998: --we will assume that in data_source.pk_col the order is an exact match to p_level_group.levels
999: l_levels.delete;
1011: l_parent_child(l_parent_child.count+1):=p_level_group.parent_child(i);
1012: end if;
1013: end loop;
1014: for i in 1..p_level_group.data_source.pk_col.count loop
1015: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.pk_col(i)||', --');
1016: end loop;
1017: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1018: bsc_aw_utility.add_g_commands(g_commands,'from --');
1019: if p_mode='initial' then
1013: end loop;
1014: for i in 1..p_level_group.data_source.pk_col.count loop
1015: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.pk_col(i)||', --');
1016: end loop;
1017: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1018: bsc_aw_utility.add_g_commands(g_commands,'from --');
1019: if p_mode='initial' then
1020: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.data_source);
1021: else
1014: for i in 1..p_level_group.data_source.pk_col.count loop
1015: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.pk_col(i)||', --');
1016: end loop;
1017: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1018: bsc_aw_utility.add_g_commands(g_commands,'from --');
1019: if p_mode='initial' then
1020: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.data_source);
1021: else
1022: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.inc_data_source);
1016: end loop;
1017: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1018: bsc_aw_utility.add_g_commands(g_commands,'from --');
1019: if p_mode='initial' then
1020: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.data_source);
1021: else
1022: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.inc_data_source);
1023: end if;
1024: --there is no where clause. the where clause is in the data_source
1018: bsc_aw_utility.add_g_commands(g_commands,'from --');
1019: if p_mode='initial' then
1020: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.data_source);
1021: else
1022: bsc_aw_utility.add_g_commands(g_commands,p_level_group.data_source.inc_data_source);
1023: end if;
1024: --there is no where clause. the where clause is in the data_source
1025: create_dim_program(p_dimension,l_levels,l_parent_child,l_zero_levels,l_snowflake_levels);
1026: else
1034: l_levels(l_levels.count+1):=p_level_group.levels(i);
1035: if p_dimension.dim_type <> 'std' then
1036: l_snowflake_levels(l_snowflake_levels.count+1):=p_level_group.levels(i);
1037: end if;
1038: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1039: bsc_aw_utility.add_g_commands(g_commands,nvl(p_level_group.levels(i).level_name||'.'||p_level_group.levels(i).pk.pk,'CODE')||', --');
1040: for j in 1..p_level_group.parent_child.count loop
1041: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name and p_level_group.parent_child(j).parent_level is not null then
1042: l_parent_child(l_parent_child.count+1):=p_level_group.parent_child(j);
1035: if p_dimension.dim_type <> 'std' then
1036: l_snowflake_levels(l_snowflake_levels.count+1):=p_level_group.levels(i);
1037: end if;
1038: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1039: bsc_aw_utility.add_g_commands(g_commands,nvl(p_level_group.levels(i).level_name||'.'||p_level_group.levels(i).pk.pk,'CODE')||', --');
1040: for j in 1..p_level_group.parent_child.count loop
1041: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name and p_level_group.parent_child(j).parent_level is not null then
1042: l_parent_child(l_parent_child.count+1):=p_level_group.parent_child(j);
1043: l_levels(l_levels.count+1):=get_level(p_dimension,p_level_group.parent_child(j).parent_level);
1040: for j in 1..p_level_group.parent_child.count loop
1041: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name and p_level_group.parent_child(j).parent_level is not null then
1042: l_parent_child(l_parent_child.count+1):=p_level_group.parent_child(j);
1043: l_levels(l_levels.count+1):=get_level(p_dimension,p_level_group.parent_child(j).parent_level);
1044: bsc_aw_utility.add_g_commands(g_commands,p_level_group.parent_child(j).child_level||'.'||p_level_group.parent_child(j).child_fk||', --');
1045: end if;
1046: end loop;
1047: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1048: bsc_aw_utility.add_g_commands(g_commands,'from --');
1043: l_levels(l_levels.count+1):=get_level(p_dimension,p_level_group.parent_child(j).parent_level);
1044: bsc_aw_utility.add_g_commands(g_commands,p_level_group.parent_child(j).child_level||'.'||p_level_group.parent_child(j).child_fk||', --');
1045: end if;
1046: end loop;
1047: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1048: bsc_aw_utility.add_g_commands(g_commands,'from --');
1049: bsc_aw_utility.add_g_commands(g_commands,p_level_group.levels(i).level_name);
1050: for j in 1..p_level_group.zero_levels.count loop
1051: if p_level_group.zero_levels(j).child_level_name=p_level_group.levels(i).level_name and p_level_group.zero_levels(j).level_name is not null then
1044: bsc_aw_utility.add_g_commands(g_commands,p_level_group.parent_child(j).child_level||'.'||p_level_group.parent_child(j).child_fk||', --');
1045: end if;
1046: end loop;
1047: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1048: bsc_aw_utility.add_g_commands(g_commands,'from --');
1049: bsc_aw_utility.add_g_commands(g_commands,p_level_group.levels(i).level_name);
1050: for j in 1..p_level_group.zero_levels.count loop
1051: if p_level_group.zero_levels(j).child_level_name=p_level_group.levels(i).level_name and p_level_group.zero_levels(j).level_name is not null then
1052: l_zero_levels(l_zero_levels.count+1):=p_level_group.zero_levels(j);
1045: end if;
1046: end loop;
1047: bsc_aw_utility.trim_g_commands(g_commands,4,' --');
1048: bsc_aw_utility.add_g_commands(g_commands,'from --');
1049: bsc_aw_utility.add_g_commands(g_commands,p_level_group.levels(i).level_name);
1050: for j in 1..p_level_group.zero_levels.count loop
1051: if p_level_group.zero_levels(j).child_level_name=p_level_group.levels(i).level_name and p_level_group.zero_levels(j).level_name is not null then
1052: l_zero_levels(l_zero_levels.count+1):=p_level_group.zero_levels(j);
1053: end if;
1070: in our case, we will mark state of ca and country of usa for re-agg
1071: the dim values are deleted in dim load module
1072: */
1073: --p_level_group.levels(i).level_name
1074: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1075: if p_level_group.levels.count>1 then
1076: for i in 1..p_level_group.levels.count loop
1077: --we only need these for levels that have parents.
1078: if level_has_parents(p_level_group.parent_child,p_level_group.levels(i).level_name) then
1075: if p_level_group.levels.count>1 then
1076: for i in 1..p_level_group.levels.count loop
1077: --we only need these for levels that have parents.
1078: if level_has_parents(p_level_group.parent_child,p_level_group.levels(i).level_name) then
1079: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select delete_value from bsc_aw_dim_delete '||
1080: ' where dim_level=\'''||p_level_group.levels(i).level_name||'\''');
1081: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1082: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1083: /*5064802. we need to handle the case where the dim value in bsc_aw_dim_delete does not exist in aw dim. go on append mode. then
1077: --we only need these for levels that have parents.
1078: if level_has_parents(p_level_group.parent_child,p_level_group.levels(i).level_name) then
1079: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select delete_value from bsc_aw_dim_delete '||
1080: ' where dim_level=\'''||p_level_group.levels(i).level_name||'\''');
1081: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1082: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1083: /*5064802. we need to handle the case where the dim value in bsc_aw_dim_delete does not exist in aw dim. go on append mode. then
1084: dim loader delete will delete them */
1085: bsc_aw_utility.add_g_commands(g_commands,':append '||p_level_group.levels(i).level_name||' --');
1078: if level_has_parents(p_level_group.parent_child,p_level_group.levels(i).level_name) then
1079: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select delete_value from bsc_aw_dim_delete '||
1080: ' where dim_level=\'''||p_level_group.levels(i).level_name||'\''');
1081: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1082: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1083: /*5064802. we need to handle the case where the dim value in bsc_aw_dim_delete does not exist in aw dim. go on append mode. then
1084: dim loader delete will delete them */
1085: bsc_aw_utility.add_g_commands(g_commands,':append '||p_level_group.levels(i).level_name||' --');
1086: bsc_aw_utility.add_g_commands(g_commands,'then --');
1081: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1082: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1083: /*5064802. we need to handle the case where the dim value in bsc_aw_dim_delete does not exist in aw dim. go on append mode. then
1084: dim loader delete will delete them */
1085: bsc_aw_utility.add_g_commands(g_commands,':append '||p_level_group.levels(i).level_name||' --');
1086: bsc_aw_utility.add_g_commands(g_commands,'then --');
1087: for j in 1..p_level_group.parent_child.count loop
1088: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name
1089: and p_level_group.parent_child(j).parent_level is not null then
1082: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1083: /*5064802. we need to handle the case where the dim value in bsc_aw_dim_delete does not exist in aw dim. go on append mode. then
1084: dim loader delete will delete them */
1085: bsc_aw_utility.add_g_commands(g_commands,':append '||p_level_group.levels(i).level_name||' --');
1086: bsc_aw_utility.add_g_commands(g_commands,'then --');
1087: for j in 1..p_level_group.parent_child.count loop
1088: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name
1089: and p_level_group.parent_child(j).parent_level is not null then
1090: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1086: bsc_aw_utility.add_g_commands(g_commands,'then --');
1087: for j in 1..p_level_group.parent_child.count loop
1088: if p_level_group.parent_child(j).child_level=p_level_group.levels(i).level_name
1089: and p_level_group.parent_child(j).parent_level is not null then
1090: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1091: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_level_group.parent_child(j).child_level||' '||
1092: p_dimension.level_name_dim||' \'''||p_level_group.parent_child(j).parent_level||'.'||
1093: p_level_group.parent_child(j).child_level||
1094: '\''))=TRUE --');
1094: '\''))=TRUE --');
1095: --setting of kpi limit cubes is done in bsc_aw_load_dim.set_kpi_limit_variables
1096: end if;
1097: end loop;
1098: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1099: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1100: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1101: end if;
1102: end loop;
1095: --setting of kpi limit cubes is done in bsc_aw_load_dim.set_kpi_limit_variables
1096: end if;
1097: end loop;
1098: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1099: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1100: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1101: end if;
1102: end loop;
1103: end if;
1096: end if;
1097: end loop;
1098: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1099: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1100: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1101: end if;
1102: end loop;
1103: end if;
1104: Exception when others then
1113: p_zero_levels zero_levels_tb,
1114: p_snowflake_levels levels_tb
1115: ) is
1116: Begin
1117: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1118: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1119: for i in 1..p_levels.count loop
1120: bsc_aw_utility.add_g_commands(g_commands,':append '||p_levels(i).level_name||' --');
1121: end loop;
1114: p_snowflake_levels levels_tb
1115: ) is
1116: Begin
1117: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1118: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1119: for i in 1..p_levels.count loop
1120: bsc_aw_utility.add_g_commands(g_commands,':append '||p_levels(i).level_name||' --');
1121: end loop;
1122: /*
1116: Begin
1117: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1118: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1119: for i in 1..p_levels.count loop
1120: bsc_aw_utility.add_g_commands(g_commands,':append '||p_levels(i).level_name||' --');
1121: end loop;
1122: /*
1123: initial hier was A>- B>- C, it changed to A>- C
1124: in this case, we need to reaggregate for A and B
1129: set kpi.LB=true. instead, we will have limit dim to dim.LB, then limit dim to children using dim.rel, then we set the kpi
1130: limit cubes
1131: */
1132: if p_parent_child.count>0 or p_zero_levels.count>0 or p_snowflake_levels.count>0 then
1133: bsc_aw_utility.add_g_commands(g_commands,'then --');
1134: --see if the relations have any change
1135: for i in 1..p_parent_child.count loop
1136: if p_parent_child(i).parent_level is not null then
1137: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1133: bsc_aw_utility.add_g_commands(g_commands,'then --');
1134: --see if the relations have any change
1135: for i in 1..p_parent_child.count loop
1136: if p_parent_child(i).parent_level is not null then
1137: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1138: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\'') ne NA --');
1139: bsc_aw_utility.add_g_commands(g_commands,'AND '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1140: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||
1141: '\'') ne '||p_dimension.dim_name||'('||
1135: for i in 1..p_parent_child.count loop
1136: if p_parent_child(i).parent_level is not null then
1137: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1138: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\'') ne NA --');
1139: bsc_aw_utility.add_g_commands(g_commands,'AND '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1140: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||
1141: '\'') ne '||p_dimension.dim_name||'('||
1142: p_parent_child(i).parent_level||' '||p_parent_child(i).parent_level||') --');
1143: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1139: bsc_aw_utility.add_g_commands(g_commands,'AND '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1140: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||
1141: '\'') ne '||p_dimension.dim_name||'('||
1142: p_parent_child(i).parent_level||' '||p_parent_child(i).parent_level||') --');
1143: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1144: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_dimension.relation_name||'('||
1145: p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||p_dimension.level_name_dim||' \'''||
1146: p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\''))=TRUE --');
1147: --bug fix.initially, it was p_parent_child(i).child_level||')=TRUE --');
1140: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||
1141: '\'') ne '||p_dimension.dim_name||'('||
1142: p_parent_child(i).parent_level||' '||p_parent_child(i).parent_level||') --');
1143: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1144: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_dimension.relation_name||'('||
1145: p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||p_dimension.level_name_dim||' \'''||
1146: p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\''))=TRUE --');
1147: --bug fix.initially, it was p_parent_child(i).child_level||')=TRUE --');
1148: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_parent_child(i).parent_level||')=TRUE --');
1144: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_dimension.relation_name||'('||
1145: p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||p_dimension.level_name_dim||' \'''||
1146: p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\''))=TRUE --');
1147: --bug fix.initially, it was p_parent_child(i).child_level||')=TRUE --');
1148: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_parent_child(i).parent_level||')=TRUE --');
1149: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1150: end if;
1151: end loop;
1152: --now, assign the new values to the rel
1145: p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||p_dimension.level_name_dim||' \'''||
1146: p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||'\''))=TRUE --');
1147: --bug fix.initially, it was p_parent_child(i).child_level||')=TRUE --');
1148: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||p_parent_child(i).parent_level||')=TRUE --');
1149: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1150: end if;
1151: end loop;
1152: --now, assign the new values to the rel
1153: for i in 1..p_parent_child.count loop
1151: end loop;
1152: --now, assign the new values to the rel
1153: for i in 1..p_parent_child.count loop
1154: if p_parent_child(i).parent_level is not null then
1155: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_parent_child(i).child_level||' '||
1156: p_dimension.level_name_dim||' \'''||p_parent_child(i).parent_level||'.'||p_parent_child(i).child_level||
1157: '\'')='||p_dimension.dim_name||'('||
1158: p_parent_child(i).parent_level||' '||p_parent_child(i).parent_level||') --');
1159: end if;
1166: /* error looks like this:
1167: ORA-36036: (XSMHIERCK01) One or more loops have been detected in relationship BSC_AW!BSC_CCDIM_100_101_102_103.REL over
1168: BSC_AW!BSC_CCDIM_100_101_102_103. The 1 items involved are
1169: */
1170: bsc_aw_utility.add_g_commands(g_commands,'if '||p_zero_levels(i).child_level_name||' NE \''0\'' --');
1171: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1172: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_zero_levels(i).child_level_name||' '||
1173: p_dimension.level_name_dim||' \'''||p_zero_levels(i).level_name||'.'||p_zero_levels(i).child_level_name||
1174: '\'')='||p_dimension.dim_name||'('||
1167: ORA-36036: (XSMHIERCK01) One or more loops have been detected in relationship BSC_AW!BSC_CCDIM_100_101_102_103.REL over
1168: BSC_AW!BSC_CCDIM_100_101_102_103. The 1 items involved are
1169: */
1170: bsc_aw_utility.add_g_commands(g_commands,'if '||p_zero_levels(i).child_level_name||' NE \''0\'' --');
1171: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1172: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_zero_levels(i).child_level_name||' '||
1173: p_dimension.level_name_dim||' \'''||p_zero_levels(i).level_name||'.'||p_zero_levels(i).child_level_name||
1174: '\'')='||p_dimension.dim_name||'('||
1175: p_zero_levels(i).child_level_name||' \''0\'') --');
1168: BSC_AW!BSC_CCDIM_100_101_102_103. The 1 items involved are
1169: */
1170: bsc_aw_utility.add_g_commands(g_commands,'if '||p_zero_levels(i).child_level_name||' NE \''0\'' --');
1171: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1172: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_zero_levels(i).child_level_name||' '||
1173: p_dimension.level_name_dim||' \'''||p_zero_levels(i).level_name||'.'||p_zero_levels(i).child_level_name||
1174: '\'')='||p_dimension.dim_name||'('||
1175: p_zero_levels(i).child_level_name||' \''0\'') --');
1176: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1172: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_zero_levels(i).child_level_name||' '||
1173: p_dimension.level_name_dim||' \'''||p_zero_levels(i).level_name||'.'||p_zero_levels(i).child_level_name||
1174: '\'')='||p_dimension.dim_name||'('||
1175: p_zero_levels(i).child_level_name||' \''0\'') --');
1176: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1177: end loop;
1178: end if;
1179: --snowflake relation. we need to populate the levels's relation that maps the levels to the zero code
1180: --in the future we may need to see if we need to create relations with other levels
1180: --in the future we may need to see if we need to create relations with other levels
1181: --but zero code will still be there.
1182: for i in 1..p_snowflake_levels.count loop
1183: if p_snowflake_levels(i).relation_name is not null then
1184: bsc_aw_utility.add_g_commands(g_commands,'if '||p_snowflake_levels(i).level_name||' NE \''0\'' --');
1185: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1186: bsc_aw_utility.add_g_commands(g_commands,p_snowflake_levels(i).relation_name||'('||p_snowflake_levels(i).level_name_dim||
1187: ' \'''||get_zero_level(p_dimension,p_snowflake_levels(i).level_name).level_name||'.'||p_snowflake_levels(i).level_name||'\'')='||
1188: p_snowflake_levels(i).level_name||'('||p_snowflake_levels(i).level_name||' \''0\'') --');
1181: --but zero code will still be there.
1182: for i in 1..p_snowflake_levels.count loop
1183: if p_snowflake_levels(i).relation_name is not null then
1184: bsc_aw_utility.add_g_commands(g_commands,'if '||p_snowflake_levels(i).level_name||' NE \''0\'' --');
1185: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1186: bsc_aw_utility.add_g_commands(g_commands,p_snowflake_levels(i).relation_name||'('||p_snowflake_levels(i).level_name_dim||
1187: ' \'''||get_zero_level(p_dimension,p_snowflake_levels(i).level_name).level_name||'.'||p_snowflake_levels(i).level_name||'\'')='||
1188: p_snowflake_levels(i).level_name||'('||p_snowflake_levels(i).level_name||' \''0\'') --');
1189: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1182: for i in 1..p_snowflake_levels.count loop
1183: if p_snowflake_levels(i).relation_name is not null then
1184: bsc_aw_utility.add_g_commands(g_commands,'if '||p_snowflake_levels(i).level_name||' NE \''0\'' --');
1185: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1186: bsc_aw_utility.add_g_commands(g_commands,p_snowflake_levels(i).relation_name||'('||p_snowflake_levels(i).level_name_dim||
1187: ' \'''||get_zero_level(p_dimension,p_snowflake_levels(i).level_name).level_name||'.'||p_snowflake_levels(i).level_name||'\'')='||
1188: p_snowflake_levels(i).level_name||'('||p_snowflake_levels(i).level_name||' \''0\'') --');
1189: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1190: end if;
1185: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1186: bsc_aw_utility.add_g_commands(g_commands,p_snowflake_levels(i).relation_name||'('||p_snowflake_levels(i).level_name_dim||
1187: ' \'''||get_zero_level(p_dimension,p_snowflake_levels(i).level_name).level_name||'.'||p_snowflake_levels(i).level_name||'\'')='||
1188: p_snowflake_levels(i).level_name||'('||p_snowflake_levels(i).level_name||' \''0\'') --');
1189: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1190: end if;
1191: end loop;
1192: end if;
1193: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1189: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1190: end if;
1191: end loop;
1192: end if;
1193: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1194: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1195: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1196: Exception when others then
1197: log_n('Exception in create_dim_program '||sqlerrm);
1190: end if;
1191: end loop;
1192: end if;
1193: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1194: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1195: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1196: Exception when others then
1197: log_n('Exception in create_dim_program '||sqlerrm);
1198: raise;
1191: end loop;
1192: end if;
1193: bsc_aw_utility.trim_g_commands(g_commands,3,null);
1194: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1195: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1196: Exception when others then
1197: log_n('Exception in create_dim_program '||sqlerrm);
1198: raise;
1199: End;
1221: Begin
1222: g_commands.delete;
1223: if p_dimension.initial_load_program is not null then
1224: l_pgm:=p_dimension.initial_load_program;
1225: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1226: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1227: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1222: g_commands.delete;
1223: if p_dimension.initial_load_program is not null then
1224: l_pgm:=p_dimension.initial_load_program;
1225: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1226: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1227: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1223: if p_dimension.initial_load_program is not null then
1224: l_pgm:=p_dimension.initial_load_program;
1225: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1226: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1227: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1224: l_pgm:=p_dimension.initial_load_program;
1225: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1226: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1227: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1227: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1228: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1229: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1230: --we select twice since we append to the real and virtual dim
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1231: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1232: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1233: bsc_aw_utility.add_g_commands(g_commands,'from --');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1234: --for rec dim, we full refresh each time
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1235: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1243: --we select parent_col twice for the virtual dim and also the name dim.
1236: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1243: --we select parent_col twice for the virtual dim and also the name dim.
1244: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1237: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1238: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1239: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' ');
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1243: --we select parent_col twice for the virtual dim and also the name dim.
1244: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1245: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||','||
1240: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1243: --we select parent_col twice for the virtual dim and also the name dim.
1244: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1245: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||','||
1246: p_dimension.level_groups(1).data_source.parent_col||','||
1247: p_dimension.level_groups(1).data_source.parent_col||','||p_dimension.level_groups(1).data_source.position_col||' --');
1248: bsc_aw_utility.add_g_commands(g_commands,'from --');
1241: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1242: --now, the child parent relations
1243: --we select parent_col twice for the virtual dim and also the name dim.
1244: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1245: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||','||
1246: p_dimension.level_groups(1).data_source.parent_col||','||
1247: p_dimension.level_groups(1).data_source.parent_col||','||p_dimension.level_groups(1).data_source.position_col||' --');
1248: bsc_aw_utility.add_g_commands(g_commands,'from --');
1249: --relation fully refreshed each time. see notes
1244: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1245: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||','||
1246: p_dimension.level_groups(1).data_source.parent_col||','||
1247: p_dimension.level_groups(1).data_source.parent_col||','||p_dimension.level_groups(1).data_source.position_col||' --');
1248: bsc_aw_utility.add_g_commands(g_commands,'from --');
1249: --relation fully refreshed each time. see notes
1250: --this does not mean kpi will need full agg. dim load will figure out if there is hier change
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1247: p_dimension.level_groups(1).data_source.parent_col||','||p_dimension.level_groups(1).data_source.position_col||' --');
1248: bsc_aw_utility.add_g_commands(g_commands,'from --');
1249: --relation fully refreshed each time. see notes
1250: --this does not mean kpi will need full agg. dim load will figure out if there is hier change
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1248: bsc_aw_utility.add_g_commands(g_commands,'from --');
1249: --relation fully refreshed each time. see notes
1250: --this does not mean kpi will need full agg. dim load will figure out if there is hier change
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1249: --relation fully refreshed each time. see notes
1250: --this does not mean kpi will need full agg. dim load will figure out if there is hier change
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1250: --this does not mean kpi will need full agg. dim load will figure out if there is hier change
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1251: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_data_source);
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1252: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1253: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1254: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1255: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1256: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1257: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.rec_level_position_cube||' --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1258: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1259: p_dimension.level_groups(1).levels(1).level_name||')='||
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1260: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1261: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1262: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1263: --set the value of the old relations to NA. these parent child relations no longer exist
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1264: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1265: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||', --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1266: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1267: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.child_col||', --');
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1268: bsc_aw_utility.add_g_commands(g_commands,'1, --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1269: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.parent_col||' --');
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1277: --we set kpi limit cubes in bsc_aw_load_dim.set_kpi_limit_variables
1270: bsc_aw_utility.add_g_commands(g_commands,'from --');
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1277: --we set kpi limit cubes in bsc_aw_load_dim.set_kpi_limit_variables
1278: --mark change for managers
1271: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.denorm_change_data_source);
1272: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1273: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1274: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1277: --we set kpi limit cubes in bsc_aw_load_dim.set_kpi_limit_variables
1278: --mark change for managers
1279: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1275: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1277: --we set kpi limit cubes in bsc_aw_load_dim.set_kpi_limit_variables
1278: --mark change for managers
1279: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1280: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1281: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1282: --mark change for employees
1283: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_name_dim||' --');
1276: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1277: --we set kpi limit cubes in bsc_aw_load_dim.set_kpi_limit_variables
1278: --mark change for managers
1279: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1280: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1281: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1282: --mark change for employees
1283: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_name_dim||' --');
1284: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1279: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).levels(1).level_name||' --');
1280: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1281: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1282: --mark change for employees
1283: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_name_dim||' --');
1284: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1285: p_dimension.level_groups(1).levels(1).level_name||')=NA ');
1286: --base value cubes will be used in the olap table functions for the kpi
1287: if p_dimension.base_value_cube is not null then
1280: bsc_aw_utility.add_g_commands(g_commands,':'||p_dimension.dim_name||'.LB('||
1281: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||') --');
1282: --mark change for employees
1283: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_name_dim||' --');
1284: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1285: p_dimension.level_groups(1).levels(1).level_name||')=NA ');
1286: --base value cubes will be used in the olap table functions for the kpi
1287: if p_dimension.base_value_cube is not null then
1288: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1284: bsc_aw_utility.add_g_commands(g_commands,'then '||p_dimension.relation_name||'('||p_dimension.dim_name||' '||
1285: p_dimension.level_groups(1).levels(1).level_name||')=NA ');
1286: --base value cubes will be used in the olap table functions for the kpi
1287: if p_dimension.base_value_cube is not null then
1288: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1289: end if;
1290: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
1291: end if;
1292: Exception when others then
1286: --base value cubes will be used in the olap table functions for the kpi
1287: if p_dimension.base_value_cube is not null then
1288: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1289: end if;
1290: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
1291: end if;
1292: Exception when others then
1293: log_n('Exception in create_dim_program_rec '||sqlerrm);
1294: raise;
1303: bsc_aw_dbms_aw.execute_ne('dfn temp_text text');
1304: g_commands.delete;
1305: if p_dimension.initial_load_program is not null then
1306: l_pgm:=p_dimension.initial_load_program;
1307: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1308: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1309: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1310: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1304: g_commands.delete;
1305: if p_dimension.initial_load_program is not null then
1306: l_pgm:=p_dimension.initial_load_program;
1307: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1308: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1309: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1310: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1312: --we select twice since we append to the real and virtual dim
1305: if p_dimension.initial_load_program is not null then
1306: l_pgm:=p_dimension.initial_load_program;
1307: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1308: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1309: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1310: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1312: --we select twice since we append to the real and virtual dim
1313: if p_dimension.level_groups(1).data_source.data_source is not null then --dbi dimension
1306: l_pgm:=p_dimension.initial_load_program;
1307: bsc_aw_utility.add_g_commands(g_commands,'dfn '||l_pgm||' program');
1308: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1309: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB=false');
1310: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1312: --we select twice since we append to the real and virtual dim
1313: if p_dimension.level_groups(1).data_source.data_source is not null then --dbi dimension
1314: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1310: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1312: --we select twice since we append to the real and virtual dim
1313: if p_dimension.level_groups(1).data_source.data_source is not null then --dbi dimension
1314: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1315: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1316: else
1317: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code1, --');
1318: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code2 --');
1311: --in rec dim, there must be only ONE real level. then there is a virtual rec level
1312: --we select twice since we append to the real and virtual dim
1313: if p_dimension.level_groups(1).data_source.data_source is not null then --dbi dimension
1314: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1315: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1316: else
1317: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code1, --');
1318: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code2 --');
1319: end if;
1313: if p_dimension.level_groups(1).data_source.data_source is not null then --dbi dimension
1314: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1315: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1316: else
1317: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code1, --');
1318: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code2 --');
1319: end if;
1320: bsc_aw_utility.add_g_commands(g_commands,'from --');
1321: --for rec dim, we full refresh each time
1314: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code1, --');
1315: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.pk_col(1)||' code2 --');
1316: else
1317: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code1, --');
1318: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code2 --');
1319: end if;
1320: bsc_aw_utility.add_g_commands(g_commands,'from --');
1321: --for rec dim, we full refresh each time
1322: if p_dimension.level_groups(1).data_source.data_source is not null then
1316: else
1317: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code1, --');
1318: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).pk.pk||' code2 --');
1319: end if;
1320: bsc_aw_utility.add_g_commands(g_commands,'from --');
1321: --for rec dim, we full refresh each time
1322: if p_dimension.level_groups(1).data_source.data_source is not null then
1323: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1324: else
1319: end if;
1320: bsc_aw_utility.add_g_commands(g_commands,'from --');
1321: --for rec dim, we full refresh each time
1322: if p_dimension.level_groups(1).data_source.data_source is not null then
1323: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1324: else
1325: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).level_name);
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1321: --for rec dim, we full refresh each time
1322: if p_dimension.level_groups(1).data_source.data_source is not null then
1323: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1324: else
1325: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).level_name);
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1323: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).data_source.data_source);
1324: else
1325: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).level_name);
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1324: else
1325: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).level_name);
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1325: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).levels(1).level_name);
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1326: end if;
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1327: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1335: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1328: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1329: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).levels(1).level_name||' --');
1330: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1335: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1336: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1331: bsc_aw_utility.add_g_commands(g_commands,'then --');
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1335: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1336: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1337: --now, the child parent relations
1338: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1339: if p_dimension.level_groups(1).data_source.data_source is not null then
1332: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1333: p_dimension.dim_name||' '||p_dimension.level_groups(1).levels(1).level_name||' '||p_dimension.level_name_dim||' \''1\'')='||
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1335: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1336: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1337: --now, the child parent relations
1338: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1339: if p_dimension.level_groups(1).data_source.data_source is not null then
1340: bsc_aw_utility.add_g_commands(g_commands,'child,parent,to_char(id) from bsc_aw_temp_pc');
1334: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')');
1335: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1336: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1337: --now, the child parent relations
1338: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1339: if p_dimension.level_groups(1).data_source.data_source is not null then
1340: bsc_aw_utility.add_g_commands(g_commands,'child,parent,to_char(id) from bsc_aw_temp_pc');
1341: else
1342: --chil fk is the parent col and parent pk is the child col
1336: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1337: --now, the child parent relations
1338: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1339: if p_dimension.level_groups(1).data_source.data_source is not null then
1340: bsc_aw_utility.add_g_commands(g_commands,'child,parent,to_char(id) from bsc_aw_temp_pc');
1341: else
1342: --chil fk is the parent col and parent pk is the child col
1343: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).parent_child(1).parent_pk||','||
1344: p_dimension.level_groups(1).parent_child(1).child_fk||',to_char(rank() over(partition by '||p_dimension.level_groups(1).parent_child(1).parent_pk||' '||
1339: if p_dimension.level_groups(1).data_source.data_source is not null then
1340: bsc_aw_utility.add_g_commands(g_commands,'child,parent,to_char(id) from bsc_aw_temp_pc');
1341: else
1342: --chil fk is the parent col and parent pk is the child col
1343: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).parent_child(1).parent_pk||','||
1344: p_dimension.level_groups(1).parent_child(1).child_fk||',to_char(rank() over(partition by '||p_dimension.level_groups(1).parent_child(1).parent_pk||' '||
1345: 'order by '||p_dimension.level_groups(1).parent_child(1).child_fk||')) id --');
1346: bsc_aw_utility.add_g_commands(g_commands,'from '||p_dimension.level_groups(1).levels(1).level_name||' where '||
1347: p_dimension.level_groups(1).parent_child(1).child_fk||' is not null');
1342: --chil fk is the parent col and parent pk is the child col
1343: bsc_aw_utility.add_g_commands(g_commands,p_dimension.level_groups(1).parent_child(1).parent_pk||','||
1344: p_dimension.level_groups(1).parent_child(1).child_fk||',to_char(rank() over(partition by '||p_dimension.level_groups(1).parent_child(1).parent_pk||' '||
1345: 'order by '||p_dimension.level_groups(1).parent_child(1).child_fk||')) id --');
1346: bsc_aw_utility.add_g_commands(g_commands,'from '||p_dimension.level_groups(1).levels(1).level_name||' where '||
1347: p_dimension.level_groups(1).parent_child(1).child_fk||' is not null');
1348: end if;
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1345: 'order by '||p_dimension.level_groups(1).parent_child(1).child_fk||')) id --');
1346: bsc_aw_utility.add_g_commands(g_commands,'from '||p_dimension.level_groups(1).levels(1).level_name||' where '||
1347: p_dimension.level_groups(1).parent_child(1).child_fk||' is not null');
1348: end if;
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1346: bsc_aw_utility.add_g_commands(g_commands,'from '||p_dimension.level_groups(1).levels(1).level_name||' where '||
1347: p_dimension.level_groups(1).parent_child(1).child_fk||' is not null');
1348: end if;
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1347: p_dimension.level_groups(1).parent_child(1).child_fk||' is not null');
1348: end if;
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1355: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||
1348: end if;
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1355: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||
1356: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE NA AND '||
1349: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1355: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||
1356: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE NA AND '||
1357: p_dimension.relation_name||'('||
1350: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1355: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||
1356: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE NA AND '||
1357: p_dimension.relation_name||'('||
1358: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE '||
1351: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1352: bsc_aw_utility.add_g_commands(g_commands,':temp_text --');
1353: bsc_aw_utility.add_g_commands(g_commands,':append '||p_dimension.level_name_dim||' --');
1354: bsc_aw_utility.add_g_commands(g_commands,'then --');
1355: bsc_aw_utility.add_g_commands(g_commands,'if '||p_dimension.relation_name||'('||
1356: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE NA AND '||
1357: p_dimension.relation_name||'('||
1358: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE '||
1359: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text) --');
1356: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE NA AND '||
1357: p_dimension.relation_name||'('||
1358: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE '||
1359: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text) --');
1360: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1361: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1362: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE --');
1363: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||
1364: p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)=TRUE --');
1357: p_dimension.relation_name||'('||
1358: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||') NE '||
1359: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text) --');
1360: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1361: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1362: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE --');
1363: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||
1364: p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)=TRUE --');
1365: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1359: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text) --');
1360: bsc_aw_utility.add_g_commands(g_commands,'then do --');
1361: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1362: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE --');
1363: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||
1364: p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)=TRUE --');
1365: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1366: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1367: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')='||
1361: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1362: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE --');
1363: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||
1364: p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)=TRUE --');
1365: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1366: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1367: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')='||
1368: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)');
1369: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1362: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE --');
1363: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||
1364: p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)=TRUE --');
1365: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1366: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1367: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')='||
1368: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)');
1369: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1370: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1365: bsc_aw_utility.add_g_commands(g_commands,'doend --');
1366: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1367: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')='||
1368: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)');
1369: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1370: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1371: --handle dim delete. this is just like for normal dim
1372: --if there are deletes, we have to mark the parents for these values for re-agg
1373: --for rec, dim the delete values are loaded into bsc_aw_dim_delete with the real level name, not the virtual parent
1366: bsc_aw_utility.add_g_commands(g_commands,p_dimension.relation_name||'('||
1367: p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||')='||
1368: p_dimension.dim_name||'('||p_dimension.level_groups(1).rec_levels(1).level_name||' temp_text)');
1369: bsc_aw_utility.add_g_commands(g_commands,'sql close c1');
1370: bsc_aw_utility.add_g_commands(g_commands,'sql cleanup');
1371: --handle dim delete. this is just like for normal dim
1372: --if there are deletes, we have to mark the parents for these values for re-agg
1373: --for rec, dim the delete values are loaded into bsc_aw_dim_delete with the real level name, not the virtual parent
1374: --level name
1371: --handle dim delete. this is just like for normal dim
1372: --if there are deletes, we have to mark the parents for these values for re-agg
1373: --for rec, dim the delete values are loaded into bsc_aw_dim_delete with the real level name, not the virtual parent
1374: --level name
1375: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1376: bsc_aw_utility.add_g_commands(g_commands,'delete_value from bsc_aw_dim_delete '||
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1372: --if there are deletes, we have to mark the parents for these values for re-agg
1373: --for rec, dim the delete values are loaded into bsc_aw_dim_delete with the real level name, not the virtual parent
1374: --level name
1375: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1376: bsc_aw_utility.add_g_commands(g_commands,'delete_value from bsc_aw_dim_delete '||
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1374: --level name
1375: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1376: bsc_aw_utility.add_g_commands(g_commands,'delete_value from bsc_aw_dim_delete '||
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1381: bsc_aw_utility.add_g_commands(g_commands,'then --');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1375: bsc_aw_utility.add_g_commands(g_commands,'sql declare c1 cursor for select --');
1376: bsc_aw_utility.add_g_commands(g_commands,'delete_value from bsc_aw_dim_delete '||
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1381: bsc_aw_utility.add_g_commands(g_commands,'then --');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1383: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE ');
1376: bsc_aw_utility.add_g_commands(g_commands,'delete_value from bsc_aw_dim_delete '||
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1381: bsc_aw_utility.add_g_commands(g_commands,'then --');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1383: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE ');
1384: --base value cubes will be used in the olap table functions for the kpi
1377: ' where dim_level=\'''||p_dimension.level_groups(1).levels(1).level_name||'\''');
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1381: bsc_aw_utility.add_g_commands(g_commands,'then --');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1383: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE ');
1384: --base value cubes will be used in the olap table functions for the kpi
1385: if p_dimension.base_value_cube is not null then
1378: bsc_aw_utility.add_g_commands(g_commands,'sql open c1');
1379: bsc_aw_utility.add_g_commands(g_commands,'sql fetch c1 loop into --');
1380: bsc_aw_utility.add_g_commands(g_commands,':match '||p_dimension.level_groups(1).rec_levels(1).level_name||' --');
1381: bsc_aw_utility.add_g_commands(g_commands,'then --');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1383: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE ');
1384: --base value cubes will be used in the olap table functions for the kpi
1385: if p_dimension.base_value_cube is not null then
1386: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1382: bsc_aw_utility.add_g_commands(g_commands,p_dimension.dim_name||'.LB('||p_dimension.dim_name||' '||
1383: p_dimension.relation_name||'('||p_dimension.dim_name||' '||p_dimension.level_groups(1).rec_levels(1).level_name||'))=TRUE ');
1384: --base value cubes will be used in the olap table functions for the kpi
1385: if p_dimension.base_value_cube is not null then
1386: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1387: end if;
1388: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
1389: end if;
1390: Exception when others then
1384: --base value cubes will be used in the olap table functions for the kpi
1385: if p_dimension.base_value_cube is not null then
1386: bsc_aw_utility.add_g_commands(g_commands,p_dimension.base_value_cube||'=baseval('||p_dimension.dim_name||')');
1387: end if;
1388: bsc_aw_utility.exec_program_commands(l_pgm,g_commands);
1389: end if;
1390: Exception when others then
1391: log_n('Exception in create_dim_program_rec_norm '||sqlerrm);
1392: raise;
1571:
1572: procedure create_dmp_program(p_dim_level varchar2,p_name varchar2) is
1573: Begin
1574: g_commands.delete;
1575: bsc_aw_utility.add_g_commands(g_commands,'dfn '||p_name||' program');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1572: procedure create_dmp_program(p_dim_level varchar2,p_name varchar2) is
1573: Begin
1574: g_commands.delete;
1575: bsc_aw_utility.add_g_commands(g_commands,'dfn '||p_name||' program');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1573: Begin
1574: g_commands.delete;
1575: bsc_aw_utility.add_g_commands(g_commands,'dfn '||p_name||' program');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1574: g_commands.delete;
1575: bsc_aw_utility.add_g_commands(g_commands,'dfn '||p_name||' program');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1575: bsc_aw_utility.add_g_commands(g_commands,'dfn '||p_name||' program');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1576: bsc_aw_utility.add_g_commands(g_commands,'allstat');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1577: bsc_aw_utility.add_g_commands(g_commands,'sql prepare c1 from --');
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1585: bsc_aw_utility.exec_program_commands(p_name,g_commands);
1578: bsc_aw_utility.add_g_commands(g_commands,'insert into bsc_aw_dim_data values (\'''||p_dim_level||'\'',:'||p_dim_level||') DIRECT=YES');
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1585: bsc_aw_utility.exec_program_commands(p_name,g_commands);
1586: Exception when others then
1579: bsc_aw_utility.add_g_commands(g_commands,'for '||p_dim_level);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1585: bsc_aw_utility.exec_program_commands(p_name,g_commands);
1586: Exception when others then
1587: log_n('Exception in create_dmp_program '||sqlerrm);
1580: bsc_aw_utility.add_g_commands(g_commands,'do');
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1585: bsc_aw_utility.exec_program_commands(p_name,g_commands);
1586: Exception when others then
1587: log_n('Exception in create_dmp_program '||sqlerrm);
1588: raise;
1581: bsc_aw_utility.add_g_commands(g_commands,'sql execute c1');
1582: bsc_aw_utility.add_g_commands(g_commands,'if sqlcode ne 0');
1583: bsc_aw_utility.add_g_commands(g_commands,'then break');
1584: bsc_aw_utility.add_g_commands(g_commands,'doend');
1585: bsc_aw_utility.exec_program_commands(p_name,g_commands);
1586: Exception when others then
1587: log_n('Exception in create_dmp_program '||sqlerrm);
1588: raise;
1589: End;
1631: l_olap_object_relation.delete;
1632: bsc_aw_md_api.get_bsc_olap_object_relation(p_dim,'dimension',null,null,null,l_olap_object_relation);
1633: for i in 1..l_olap_object_relation.count loop
1634: --do this only if the limit cube is "actual" limit cube. not if its target limit cube
1635: if bsc_aw_utility.get_parameter_value(l_olap_object_relation(i).property1,'dim set type',',')='actual' then
1636: if l_olap_object_relation(i).relation_type='kpi limit cube' then
1637: p_limit_cubes(p_limit_cubes.count+1):=l_olap_object_relation(i).relation_object;
1638: elsif l_olap_object_relation(i).relation_type='kpi aggregate marker' then
1639: p_aggregate_marker(p_aggregate_marker.count+1):=l_olap_object_relation(i).relation_object;
1813: l_max number;
1814: Begin
1815: for i in 1..p_new_dim.level_groups.count loop
1816: for j in 1..p_new_dim.level_groups(i).levels.count loop
1817: bsc_aw_utility.merge_value(l_new_levels,p_new_dim.level_groups(i).levels(j).level_name);
1818: end loop;
1819: end loop;
1820: --
1821: for i in 1..p_old_dim.count loop
1821: for i in 1..p_old_dim.count loop
1822: l_number_match(i):=0;
1823: for j in 1..p_old_dim(i).level_groups.count loop
1824: for k in 1..p_old_dim(i).level_groups(j).levels.count loop
1825: if bsc_aw_utility.in_array(l_new_levels,p_old_dim(i).level_groups(j).levels(k).level_name) then
1826: l_number_match(i):=l_number_match(i)+1;
1827: end if;
1828: end loop;
1829: end loop;
1830: if g_debug then
1831: log('For old dim '||p_old_dim(i).dim_name||', number of levels matching new dim='||l_number_match(i));
1832: end if;
1833: end loop;
1834: l_max:=bsc_aw_utility.get_max(l_number_match);
1835: for i in 1..p_old_dim.count loop
1836: if l_number_match(i)=l_max then
1837: merge_dim(p_old_dim(i),p_new_dim);
1838: --correct all others
1907: for i in 1..p_new_level.count loop
1908: l_levels(l_levels.count+1):=p_new_level(i).level_name;
1909: end loop;
1910: for i in 1..p_old_zero_level.count loop
1911: if bsc_aw_utility.in_array(l_levels,p_old_zero_level(i).child_level_name) then
1912: p_new_zero_level(p_new_zero_level.count+1):=p_old_zero_level(i);
1913: end if;
1914: end loop;
1915: Exception when others then
1925: for i in 1..p_level_group.levels.count loop
1926: l_dim_levels(l_dim_levels.count+1):=p_level_group.levels(i).level_name;
1927: end loop;
1928: for i in 1..p_old_pc.count loop
1929: if bsc_aw_utility.in_array(l_dim_levels,p_old_pc(i).child_level) then
1930: bsc_aw_utility.merge_value(l_levels,p_old_pc(i).child_level);
1931: end if;
1932: end loop;
1933: for i in 1..l_levels.count loop
1926: l_dim_levels(l_dim_levels.count+1):=p_level_group.levels(i).level_name;
1927: end loop;
1928: for i in 1..p_old_pc.count loop
1929: if bsc_aw_utility.in_array(l_dim_levels,p_old_pc(i).child_level) then
1930: bsc_aw_utility.merge_value(l_levels,p_old_pc(i).child_level);
1931: end if;
1932: end loop;
1933: for i in 1..l_levels.count loop
1934: l_parents.delete;
1935: bsc_aw_bsc_metadata.get_parent_level(l_levels(i),l_parents); --does not return top node
1936: for j in 1..p_old_pc.count loop
1937: if p_old_pc(j).child_level=l_levels(i) then
1938: --if p_old_pc(j).parent_level is null and l_parents.count=0
1939: --and bsc_aw_utility.in_array(l_dim_levels,p_old_pc(j).parent_level) then
1940: if p_old_pc(j).parent_level is null then
1941: p_new_pc(p_new_pc.count+1):=p_old_pc(j);
1942: elsif l_parents.count=0 then
1943: p_new_pc(p_new_pc.count+1):=p_old_pc(j);
1943: p_new_pc(p_new_pc.count+1):=p_old_pc(j);
1944: p_new_pc(p_new_pc.count).parent_level:=null;
1945: p_new_pc(p_new_pc.count).parent_pk:=null;
1946: p_new_pc(p_new_pc.count).child_fk:=null;
1947: elsif bsc_aw_utility.in_array(l_parents,p_old_pc(j).parent_level)
1948: and bsc_aw_utility.in_array(l_dim_levels,p_old_pc(j).parent_level) then
1949: p_new_pc(p_new_pc.count+1):=p_old_pc(j);
1950: else
1951: --this relation is no more valid
1944: p_new_pc(p_new_pc.count).parent_level:=null;
1945: p_new_pc(p_new_pc.count).parent_pk:=null;
1946: p_new_pc(p_new_pc.count).child_fk:=null;
1947: elsif bsc_aw_utility.in_array(l_parents,p_old_pc(j).parent_level)
1948: and bsc_aw_utility.in_array(l_dim_levels,p_old_pc(j).parent_level) then
1949: p_new_pc(p_new_pc.count+1):=p_old_pc(j);
1950: else
1951: --this relation is no more valid
1952: null;
2076: p_new_level_groups(p_new_level_groups.count).parent_child(p_new_level_groups(p_new_level_groups.count).parent_child.count+1):=
2077: l_old_level_group.parent_child(j);
2078: --
2079: if l_old_level_group.parent_child(j).child_level is not null
2080: and bsc_aw_utility.in_array(l_level_considered,l_old_level_group.parent_child(j).child_level)=false then
2081: p_new_level_groups(p_new_level_groups.count).levels(p_new_level_groups(p_new_level_groups.count).levels.count+1):=
2082: get_level(l_old_level_group,l_old_level_group.parent_child(j).child_level);
2083: l_zero_level:=get_zero_level(l_old_level_group,l_old_level_group.parent_child(j).child_level);
2084: if l_zero_level.level_name is not null then
2093: l_level_considered(l_level_considered.count+1):=l_old_level_group.parent_child(j).child_level;
2094: end if;
2095: --
2096: if l_old_level_group.parent_child(j).parent_level is not null
2097: and bsc_aw_utility.in_array(l_level_considered,l_old_level_group.parent_child(j).parent_level)=false then
2098: p_new_level_groups(p_new_level_groups.count).levels(p_new_level_groups(p_new_level_groups.count).levels.count+1):=
2099: get_level(l_old_level_group,l_old_level_group.parent_child(j).parent_level);
2100: l_zero_level:=get_zero_level(l_old_level_group,l_old_level_group.parent_child(j).parent_level);
2101: if l_zero_level.level_name is not null then
2154: end if;
2155: --
2156: if p_flag is null then
2157: for i in 1..l_old_level_list.count loop
2158: if bsc_aw_utility.in_array(l_level_list,l_old_level_list(i))=false then -- no merge possible. correction reqd
2159: p_flag:='correct';
2160: exit;
2161: end if;
2162: end loop;
2225: 2: 2 is in 1
2226: */
2227: function compare_pc_relations(p_pc_1 dim_parent_child_tb,p_pc_2 dim_parent_child_tb) return number is
2228: --
2229: l_pc_1 bsc_aw_utility.parent_child_tb;
2230: l_pc_2 bsc_aw_utility.parent_child_tb;
2231: Begin
2232: for i in 1..p_pc_1.count loop
2233: l_pc_1(i).parent:=p_pc_1(i).parent_level;
2226: */
2227: function compare_pc_relations(p_pc_1 dim_parent_child_tb,p_pc_2 dim_parent_child_tb) return number is
2228: --
2229: l_pc_1 bsc_aw_utility.parent_child_tb;
2230: l_pc_2 bsc_aw_utility.parent_child_tb;
2231: Begin
2232: for i in 1..p_pc_1.count loop
2233: l_pc_1(i).parent:=p_pc_1(i).parent_level;
2234: l_pc_1(i).child:=p_pc_1(i).child_level;
2236: for i in 1..p_pc_2.count loop
2237: l_pc_2(i).parent:=p_pc_2(i).parent_level;
2238: l_pc_2(i).child:=p_pc_2(i).child_level;
2239: end loop;
2240: return bsc_aw_utility.compare_pc_relations(l_pc_1,l_pc_2);
2241: Exception when others then
2242: log_n('Exception in compare_pc_relations '||sqlerrm);
2243: raise;
2244: End;
2288: l_count number;
2289: Begin
2290: l_count:=0;
2291: loop --till we get unique name
2292: if l_count>bsc_aw_utility.g_infinite_loop then
2293: log('Infinite loop detected in check_dim_name_conflict');
2294: raise bsc_aw_utility.g_exception;
2295: end if;
2296: if bsc_aw_md_api.is_dim_present(p_dimension.dim_name)=false then --no name conflict
2290: l_count:=0;
2291: loop --till we get unique name
2292: if l_count>bsc_aw_utility.g_infinite_loop then
2293: log('Infinite loop detected in check_dim_name_conflict');
2294: raise bsc_aw_utility.g_exception;
2295: end if;
2296: if bsc_aw_md_api.is_dim_present(p_dimension.dim_name)=false then --no name conflict
2297: exit;
2298: end if;
2296: if bsc_aw_md_api.is_dim_present(p_dimension.dim_name)=false then --no name conflict
2297: exit;
2298: end if;
2299: l_count:=l_count+1;
2300: make_dim_name(p_dimension,get_dim_name_hash_string(p_dimension)||'.'||bsc_aw_utility.get_dbms_time);
2301: end loop;
2302: if g_debug then
2303: log('check_dim_name_conflict, final dim name '||p_dimension.dim_name);
2304: end if;
2453: l_oo bsc_aw_md_wrapper.bsc_olap_object_tb;
2454: Begin
2455: bsc_aw_md_api.get_bsc_olap_object(null,'dimension level',p_dim,'dimension',l_oo);
2456: for i in 1..l_oo.count loop
2457: if bsc_aw_utility.get_parameter_value(l_oo(i).property1,'level source',',')='view' then
2458: return 'Y';
2459: end if;
2460: end loop;
2461: return 'N';
2464: raise;
2465: End;
2466:
2467: procedure upgrade(p_new_version number,p_old_version number) is
2468: l_action bsc_aw_utility.boolean_table;
2469: Begin
2470: init_all;
2471: if g_debug then
2472: log('Dim upgrade New='||p_new_version||', Old='||p_old_version||bsc_aw_utility.get_time);
2468: l_action bsc_aw_utility.boolean_table;
2469: Begin
2470: init_all;
2471: if g_debug then
2472: log('Dim upgrade New='||p_new_version||', Old='||p_old_version||bsc_aw_utility.get_time);
2473: end if;
2474: if p_new_version>p_old_version then
2475: if p_old_version<2 then
2476: /*upgrade to handle 5064802 */
2484:
2485: -------------------------
2486: procedure init_all is
2487: Begin
2488: g_debug:=bsc_aw_utility.g_debug;
2489: null;
2490: Exception when others then
2491: log_n('Exception in init_all '||sqlerrm);
2492: raise;
2493: End;
2494:
2495: procedure log(p_message varchar2) is
2496: Begin
2497: bsc_aw_utility.log(p_message);
2498: Exception when others then
2499: null;
2500: End;
2501: