@@ -210,51 +210,40 @@ create or replace type body ut_data_value_refcursor as
210210 return l_result_string;
211211 end;
212212
213- overriding member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2) return integer is
214- l_result integer := 0;
215- l_other ut_data_value_refcursor;
216- begin
217- if not a_other is of (ut_data_value_refcursor) then
218- raise value_error;
219- end if;
220-
221- l_other := treat(a_other as ut_data_value_refcursor);
222- --if column names/types are not equal - build a diff of column names and types
223- if ut_compound_data_helper.columns_hash( self, a_exclude_xpath, a_include_xpath )
224- != ut_compound_data_helper.columns_hash( l_other, a_exclude_xpath, a_include_xpath )
225- then
226- l_result := 1;
227- end if;
228- l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath);
229- return l_result;
230- end;
231-
232213 overriding 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
233214 l_result integer := 0;
234215 l_other ut_data_value_refcursor;
235- l_missing_pk ut_compound_data_helper.tt_missing_pk := ut_compound_data_helper.tt_missing_pk();
216+ function is_pk_missing (a_pk_missing_tab ut_compound_data_helper.tt_missing_pk) return integer is
217+ begin
218+ return case when a_pk_missing_tab.count > 0 then 1 else 0 end;
219+ end;
236220 begin
237221 if not a_other is of (ut_data_value_refcursor) then
238222 raise value_error;
239223 end if;
240224
241225 l_other := treat(a_other as ut_data_value_refcursor);
242226
243- l_missing_pk := ut_compound_data_helper.is_pk_exists(self.key_info, l_other.key_info, a_exclude_xpath, a_include_xpath,a_join_by_xpath);
244227 --if we join by key and key is missing fail and report error
245- if a_join_by_xpath is not null and l_missing_pk.count > 0 then
246- l_result := 1;
247- return l_result;
228+ if a_join_by_xpath is not null then
229+ l_result := is_pk_missing(ut_compound_data_helper.is_pk_exists(self.key_info, l_other.key_info, a_exclude_xpath, a_include_xpath,a_join_by_xpath));
248230 end if;
249231
250- --if column names/types are not equal - build a diff of column names and types
251- if ut_compound_data_helper.columns_hash( self, a_exclude_xpath, a_include_xpath )
252- != ut_compound_data_helper.columns_hash( l_other, a_exclude_xpath, a_include_xpath )
253- then
254- l_result := 1;
232+ if l_result = 0 then
233+ --if column names/types are not equal - build a diff of column names and types
234+ if ut_compound_data_helper.columns_hash( self, a_exclude_xpath, a_include_xpath )
235+ != ut_compound_data_helper.columns_hash( l_other, a_exclude_xpath, a_include_xpath )
236+ then
237+ l_result := 1;
238+ end if;
239+
240+ if a_unordered then
241+ l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath, a_join_by_xpath, a_unordered);
242+ else
243+ l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath);
244+ end if;
255245 end if;
256246
257- l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath, a_join_by_xpath, a_unordered);
258247 return l_result;
259248 end;
260249
0 commit comments