@@ -264,7 +264,7 @@ create or replace package body ut_compound_data_helper is
264264 l_partition_tmp clob;
265265 l_col_name varchar2(100);
266266 begin
267- if l_cursor_info is not null then
267+ if l_cursor_info is not empty then
268268 --Parition by piece
269269 ut_utils.append_to_clob(a_partition_stmt,', row_number() over (partition by ');
270270 for i in 1..l_cursor_info.count loop
@@ -321,8 +321,11 @@ create or replace package body ut_compound_data_helper is
321321
322322
323323 function gen_compare_sql(
324- a_inclusion_type boolean, a_is_negated boolean, a_unordered boolean,
325- a_other ut_data_value_refcursor := null, a_join_by_list ut_varchar2_list := ut_varchar2_list()
324+ a_other ut_data_value_refcursor,
325+ a_join_by_list ut_varchar2_list,
326+ a_unordered boolean,
327+ a_inclusion_type boolean,
328+ a_is_negated boolean
326329 ) return clob is
327330 l_compare_sql clob;
328331 l_temp_string varchar2(32767);
@@ -372,35 +375,35 @@ create or replace package body ut_compound_data_helper is
372375 end if;
373376
374377 if (a_join_by_list.count = 0) and a_unordered then
375- -- If no key defined do the join on all columns
376- ut_utils.append_to_clob(l_compare_sql,l_equal_stmt);
377- elsif (a_join_by_list.count > 0) and a_unordered then
378- -- If key defined do the join or these and where on diffrences
379- ut_utils.append_to_clob(l_compare_sql,l_join_on_stmt);
380- elsif not a_unordered then
381- ut_utils.append_to_clob(l_compare_sql, 'a.item_no = e.item_no ' );
382- end if;
378+ -- If no key defined do the join on all columns
379+ ut_utils.append_to_clob(l_compare_sql,l_equal_stmt);
380+ elsif (a_join_by_list.count > 0) and a_unordered then
381+ -- If key defined do the join or these and where on diffrences
382+ ut_utils.append_to_clob(l_compare_sql,l_join_on_stmt);
383+ elsif not a_unordered then
384+ ut_utils.append_to_clob(l_compare_sql, 'a.item_no = e.item_no ' );
385+ end if;
383386
384- ut_utils.append_to_clob(l_compare_sql,' ) where ');
387+ ut_utils.append_to_clob(l_compare_sql,' ) where ');
385388
386- if (a_join_by_list.count > 0) and (a_unordered) and (not a_is_negated) then
387- if l_not_equal_stmt is not null then
388- ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
389- end if;
390- elsif not a_unordered and l_not_equal_stmt is not null then
391- ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
392- end if;
389+ if (a_join_by_list.count > 0) and (a_unordered) and (not a_is_negated) then
390+ if l_not_equal_stmt is not null then
391+ ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
392+ end if;
393+ elsif not a_unordered and l_not_equal_stmt is not null then
394+ ut_utils.append_to_clob(l_compare_sql,' ( '||l_not_equal_stmt||' ) or ');
395+ end if;
393396
394- --If its inlcusion we expect a actual set to fully match and have no extra elements over expected
395- if a_inclusion_type and not(a_is_negated) then
396- l_temp_string := ' ( a.data_id is null ) ';
397- elsif a_inclusion_type and a_is_negated then
398- l_temp_string := ' 1 = 1 ';
399- else
400- l_temp_string := ' (a.data_id is null or e.data_id is null) ';
401- end if;
402- ut_utils.append_to_clob(l_compare_sql,l_temp_string);
403- return l_compare_sql;
397+ --If its inlcusion we expect a actual set to fully match and have no extra elements over expected
398+ if a_inclusion_type and not(a_is_negated) then
399+ l_temp_string := ' ( a.data_id is null ) ';
400+ elsif a_inclusion_type and a_is_negated then
401+ l_temp_string := ' 1 = 1 ';
402+ else
403+ l_temp_string := ' (a.data_id is null or e.data_id is null) ';
404+ end if;
405+ ut_utils.append_to_clob(l_compare_sql,l_temp_string);
406+ return l_compare_sql;
404407 end;
405408
406409 function get_column_extract_path(a_cursor_info ut_cursor_column_tab) return ut_varchar2_list is
@@ -631,21 +634,6 @@ create or replace package body ut_compound_data_helper is
631634 return g_diff_count;
632635 end;
633636
634- function getxmlchildren(a_parent_name varchar2,a_cursor_table ut_cursor_column_tab)
635- return xmltype is
636- l_result xmltype;
637- begin
638- select xmlagg(xmlelement(evalname t.column_name,t.column_type,
639- getxmlchildren(t.column_name,a_cursor_table)))
640- into l_result
641- from table(a_cursor_table) t
642- where (a_parent_name is not null and parent_name = a_parent_name and hierarchy_level > 1 and column_name is not null)
643- or (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null)
644- having count(*) > 0;
645-
646- return l_result;
647- end;
648-
649637 function is_sql_compare_allowed(a_type_name varchar2)
650638 return boolean is
651639 l_assert boolean;
0 commit comments