@@ -69,28 +69,6 @@ create or replace package body ut_compound_data_helper is
6969 from act a {:join_type:} exp e on ( {:join_condition:} )
7070 where {:where_condition:}]';
7171
72- function get_columns_filter(
73- a_exclude_xpath varchar2, a_include_xpath varchar2,
74- a_table_alias varchar2 := 'ucd', a_column_alias varchar2 := 'item_data'
75- ) return varchar2 is
76- l_filter varchar2(32767);
77- l_source_column varchar2(500) := a_table_alias||'.'||a_column_alias;
78- begin
79- -- this SQL statement is constructed in a way that we always get the same number and ordering of substitution variables
80- -- That is, we always get: l_exclude_xpath, l_include_xpath
81- -- regardless if the variables are NULL (not to be used) or NOT NULL and will be used for filtering
82- if a_exclude_xpath is null and a_include_xpath is null then
83- l_filter := ':l_exclude_xpath, :l_include_xpath, '||l_source_column||' as '||a_column_alias;
84- elsif a_exclude_xpath is not null and a_include_xpath is null then
85- l_filter := 'deletexml( '||l_source_column||', :l_exclude_xpath ) as '||a_column_alias||', :l_include_xpath';
86- elsif a_exclude_xpath is null and a_include_xpath is not null then
87- l_filter := ':l_exclude_xpath, extract( '||l_source_column||', :l_include_xpath ) as '||a_column_alias;
88- elsif a_exclude_xpath is not null and a_include_xpath is not null then
89- l_filter := 'extract( deletexml( '||l_source_column||', :l_exclude_xpath ), :l_include_xpath ) as '||a_column_alias;
90- end if;
91- return l_filter;
92- end;
93-
9472 function get_columns_diff(
9573 a_expected ut_cursor_column_tab,
9674 a_actual ut_cursor_column_tab,
@@ -530,82 +508,6 @@ create or replace package body ut_compound_data_helper is
530508 return l_results;
531509 end;
532510
533- --TODO : removal
534- function get_rows_diff(
535- a_expected_dataset_guid raw, a_actual_dataset_guid raw, a_diff_id raw,
536- a_max_rows integer, a_exclude_xpath varchar2, a_include_xpath varchar2
537- ) return tt_row_diffs is
538- l_column_filter varchar2(32767);
539- l_results tt_row_diffs;
540- begin
541- l_column_filter := get_columns_filter(a_exclude_xpath,a_include_xpath);
542- execute immediate q'[
543- with
544- diff_info as ( select item_no
545- from
546- (select item_no from ut_compound_data_diff_tmp ucdc where diff_id = :diff_guid order by item_no asc)
547- where rownum <= :max_rows)
548- select *
549- from (select rn, diff_type, xmlserialize(content data_item no indent) diffed_row, null pk_value
550- from (select nvl(exp.rn, act.rn) rn,
551- xmlagg(exp.col order by exp.col_no) exp_item,
552- xmlagg(act.col order by act.col_no) act_item
553- from (select r.item_no as rn, rownum col_no, s.column_value col,
554- s.column_value.getRootElement() col_name,
555- s.column_value.getclobval() col_val
556- from (select ]'||l_column_filter||q'[, ucd.item_no, ucd.item_data item_data_no_filter
557- from ut_compound_data_tmp ucd,
558- diff_info i
559- where ucd.data_id = :self_guid
560- and ucd.item_no = i.item_no
561- ) r,
562- table( xmlsequence( extract(r.item_data,'/*/*') ) ) s
563- ) exp
564- join (
565- select item_no as rn, rownum col_no, s.column_value col,
566- s.column_value.getRootElement() col_name,
567- s.column_value.getclobval() col_val
568- from (select ]'||l_column_filter||q'[, ucd.item_no, ucd.item_data item_data_no_filter
569- from ut_compound_data_tmp ucd,
570- diff_info i
571- where ucd.data_id = :other_guid
572- and ucd.item_no = i.item_no
573- ) r,
574- table( xmlsequence( extract(r.item_data,'/*/*') ) ) s
575- ) act
576- on exp.rn = act.rn and exp.col_name = act.col_name
577- where dbms_lob.compare(exp.col_val, act.col_val) != 0
578- group by exp.rn, act.rn
579- )
580- unpivot ( data_item for diff_type in (exp_item as 'Expected:', act_item as 'Actual:') )
581- )
582- union all
583- select nvl(exp.item_no, act.item_no) rn,
584- case when exp.item_no is null then 'Extra:' else 'Missing:' end as diff_type,
585- xmlserialize(content nvl(exp.item_data, act.item_data) no indent) diffed_row,
586- null pk_value
587- from (select ucd.item_no, extract(ucd.item_data,'/*/*') item_data
588- from ut_compound_data_tmp ucd
589- where ucd.data_id = :self_guid
590- and ucd.item_no in (select i.item_no from diff_info i)
591- ) exp
592- full outer join (
593- select ucd.item_no, extract(ucd.item_data,'/*/*') item_data
594- from ut_compound_data_tmp ucd
595- where ucd.data_id = :other_guid
596- and ucd.item_no in (select i.item_no from diff_info i)
597- )act
598- on exp.item_no = act.item_no
599- where exp.item_no is null or act.item_no is null
600- order by 1, 2]'
601- bulk collect into l_results
602- using a_diff_id, a_max_rows,
603- a_exclude_xpath, a_include_xpath, a_expected_dataset_guid,
604- a_exclude_xpath, a_include_xpath, a_actual_dataset_guid,
605- a_expected_dataset_guid, a_actual_dataset_guid;
606- return l_results;
607- end;
608-
609511 function get_hash(a_data raw, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash is
610512 begin
611513 return dbms_crypto.hash(a_data, a_hash_type);
0 commit comments