@@ -173,12 +173,9 @@ create or replace package body ut_compound_data_helper is
173173 if l_pk_tab.count <> 0 then
174174 l_index:= l_pk_tab.first;
175175 loop
176- if a_data_info.access_path = l_pk_tab(l_index) then
177- l_sql_stmt := case when a_join_by_stmt is null then null else ' and ' end;
178- l_sql_stmt := l_sql_stmt ||' a.'||a_col_name||q'[ = ]'||' e.'||a_col_name;
179- elsif a_data_info.parent_name = l_pk_tab(l_index)then
176+ if l_pk_tab(l_index) in (a_data_info.access_path, a_data_info.parent_name) then
180177 --When then table is nested and join is on whole table
181- l_sql_stmt := case when a_join_by_stmt is null then null else ' and ' end;
178+ l_sql_stmt := case when a_join_by_stmt is null then null else ' and ' end;
182179 l_sql_stmt := l_sql_stmt ||' a.'||a_col_name||q'[ = ]'||' e.'||a_col_name;
183180 end if;
184181 exit when (a_data_info.access_path = l_pk_tab(l_index)) or l_index = l_pk_tab.count;
@@ -206,12 +203,9 @@ create or replace package body ut_compound_data_helper is
206203 if l_pk_tab.count <> 0 then
207204 l_index:= l_pk_tab.first;
208205 loop
209- if a_data_info.access_path = l_pk_tab(l_index) then
210- l_sql_stmt := case when a_partition_stmt is null then null else ',' end;
211- l_sql_stmt := l_sql_stmt ||l_alias||a_col_name;
212- elsif a_data_info.parent_name = l_pk_tab(l_index)then
206+ if l_pk_tab(l_index) in (a_data_info.access_path, a_data_info.parent_name) then
213207 --When then table is nested and join is on whole table
214- l_sql_stmt := case when a_partition_stmt is null then null else ',' end;
208+ l_sql_stmt := case when a_partition_stmt is null then null else ',' end;
215209 l_sql_stmt := l_sql_stmt ||l_alias||a_col_name;
216210 end if;
217211
@@ -261,9 +255,11 @@ create or replace package body ut_compound_data_helper is
261255 ut_utils.append_to_clob(a_sql_stmt, l_sql_stmt);
262256 end;
263257
264- procedure gen_sql_pieces_out_of_cursor(a_data_info ut_cursor_column_tab,a_pk_table ut_varchar2_list, a_xml_stmt out nocopy clob,
265- a_select_stmt out nocopy clob ,a_partition_stmt out nocopy clob, a_equal_stmt out nocopy clob, a_join_by_stmt out nocopy clob,
266- a_not_equal_stmt out nocopy clob) is
258+ procedure gen_sql_pieces_out_of_cursor(
259+ a_data_info ut_cursor_column_tab,a_pk_table ut_varchar2_list, a_xml_stmt out nocopy clob,
260+ a_select_stmt out nocopy clob ,a_partition_stmt out nocopy clob, a_equal_stmt out nocopy clob, a_join_by_stmt out nocopy clob,
261+ a_not_equal_stmt out nocopy clob
262+ ) is
267263 l_cursor_info ut_cursor_column_tab := a_data_info;
268264 l_partition_tmp clob;
269265 l_col_name varchar2(100);
@@ -338,13 +334,12 @@ create or replace package body ut_compound_data_helper is
338334
339335 function get_join_type(a_inclusion_compare in boolean,a_negated in boolean) return varchar2 is
340336 begin
341- if a_inclusion_compare and not(a_negated) then
342- return ' right outer join ';
343- elsif a_inclusion_compare and a_negated then
344- return ' inner join ';
345- else
346- return ' full outer join ';
347- end if;
337+ return
338+ case
339+ when a_inclusion_compare and not(a_negated) then ' right outer join '
340+ when a_inclusion_compare and a_negated then ' inner join '
341+ else ' full outer join '
342+ end;
348343 end;
349344
350345 begin
@@ -388,10 +383,8 @@ create or replace package body ut_compound_data_helper is
388383 if l_not_equal_stmt is not null then
389384 ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
390385 end if;
391- elsif not a_unordered then
392- if l_not_equal_stmt is not null then
393- ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
394- end if;
386+ elsif not a_unordered and l_not_equal_stmt is not null then
387+ ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
395388 end if;
396389
397390 --If its inlcusion we expect a actual set to fully match and have no extra elements over expected
@@ -420,8 +413,6 @@ create or replace package body ut_compound_data_helper is
420413 a_expected_dataset_guid raw, a_actual_dataset_guid raw, a_diff_id raw,
421414 a_join_by_list ut_varchar2_list, a_unordered boolean, a_enforce_column_order boolean := false
422415 ) return tt_row_diffs is
423- l_act_col_filter varchar2(32767);
424- l_exp_col_filter varchar2(32767);
425416 l_act_extract_xpath varchar2(32767):= ut_utils.to_xpath(get_column_extract_path(a_act_cursor_info));
426417 l_exp_extract_xpath varchar2(32767):= ut_utils.to_xpath(get_column_extract_path(a_exp_cursor_info));
427418 l_join_xpath varchar2(32767) := ut_utils.to_xpath(a_join_by_list);
@@ -636,8 +627,11 @@ create or replace package body ut_compound_data_helper is
636627 end;
637628
638629 --Filter out columns from cursor based on include (exists) or exclude (not exists)
639- function filter_out_cols(a_cursor_info ut_cursor_column_tab, a_current_list ut_varchar2_list,a_include boolean := true)
640- return ut_cursor_column_tab is
630+ function filter_out_cols(
631+ a_cursor_info ut_cursor_column_tab,
632+ a_current_list ut_varchar2_list,
633+ a_include boolean := true
634+ ) return ut_cursor_column_tab is
641635 l_result ut_cursor_column_tab := ut_cursor_column_tab();
642636 l_filter_sql varchar2(32767);
643637 begin
@@ -690,7 +684,7 @@ create or replace package body ut_compound_data_helper is
690684 l_include boolean;
691685 begin
692686 -- if include and exclude is not null its columns from include minus exclude
693- -- If inlcude is not null and exclude is null cursor will have only include
687+ -- If include is not null and exclude is null cursor will have only include
694688 -- If exclude is not null and include is null cursor will have all except exclude
695689 if a_include_xpath.count > 0 and a_exclude_xpath.count > 0 then
696690 select col_names bulk collect into l_filtered_set
0 commit comments