@@ -194,7 +194,8 @@ create or replace type body ut_compound_data_value as
194194 return l_result;
195195 end;
196196
197- member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2, a_unordered boolean ) return integer is
197+ member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2,
198+ a_unordered boolean , a_inclusion_compare boolean := false ) return integer is
198199 l_other ut_compound_data_value;
199200 l_ut_owner varchar2(250) := ut_utils.ut_owner;
200201 l_column_filter varchar2(32767);
@@ -249,7 +250,11 @@ create or replace type body ut_compound_data_value as
249250 tgt.pk_hash = src.pk_hash ]'
250251 using a_exclude_xpath, a_include_xpath,a_join_by_xpath,self.data_id, l_other.data_id;
251252
252- /* Peform minus on two sets two get diffrences that will be used later on to print results */
253+ /*!*
254+ * Comparision is based on type of search, for inclusion based search we will look for left join only.
255+ * For normal two side diff we will peform minus on two sets two get diffrences.
256+ * SELF is expected
257+ */
253258 execute immediate 'insert into ' || l_ut_owner || '.ut_compound_data_diff_tmp ( diff_id,item_hash,pk_hash,duplicate_no)
254259 with source_data as
255260 ( select t.data_id,t.item_hash,row_number() over (partition by t.pk_hash,t.item_hash,t.data_id order by 1,2) duplicate_no,
@@ -258,30 +263,47 @@ create or replace type body ut_compound_data_value as
258263 where data_id = :self_guid or data_id = :other_guid
259264 )
260265 select distinct :diff_id,tmp.item_hash,tmp.pk_hash,tmp.duplicate_no
261- from(
266+ from(
262267 (
263268 select t.item_hash,t. duplicate_no,t.pk_hash
264269 from source_data t
265- where t.data_id = :self_guid
270+ where t.data_id = :other_guid
266271 minus
267272 select t.item_hash,t. duplicate_no,t.pk_hash
268273 from source_data t
269- where t.data_id = :other_guid
274+ where t.data_id = :self_guid
270275 )
271276 union all
272277 (
273278 select t.item_hash,t. duplicate_no,t.pk_hash
274279 from source_data t
275- where t.data_id = :other_guid
280+ where t.data_id = :self_guid '
281+ ||
282+ case when a_inclusion_compare then
283+ ' and 1 = 2 '
284+ else
285+ null
286+ end ||
287+ '
276288 minus
277289 select t.item_hash,t. duplicate_no,t.pk_hash
278290 from source_data t
279- where t.data_id = :self_guid
280- ))tmp'
291+ where t.data_id = :other_guid '
292+ ||
293+ case when a_inclusion_compare then
294+ ' and 1 = 2 '
295+ else
296+ null
297+ end ||
298+ '
299+ )
300+ )
301+ tmp'
281302 using self.data_id, l_other.data_id,
282303 l_diff_id,
283- self.data_id, l_other.data_id,
284- l_other.data_id,self.data_id;
304+ l_other.data_id,self.data_id,
305+ self.data_id, l_other.data_id;
306+
285307 --result is OK only if both are same
286308 if sql%rowcount = 0 and self.elements_count = l_other.elements_count then
287309 l_result := 0;
0 commit comments