@@ -78,7 +78,7 @@ create or replace type body ut_compound_data_value as
7878
7979 member function get_data_diff(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2,
8080 a_join_by_xpath varchar2, a_unordered boolean) return clob is
81- c_max_rows constant integer := 20 ;
81+ c_max_rows integer := ut_utils.gc_diff_max_rows ;
8282 l_result clob;
8383 l_results ut_utils.t_clob_tab := ut_utils.t_clob_tab();
8484 l_message varchar2(32767);
@@ -269,27 +269,21 @@ create or replace type body ut_compound_data_value as
269269 l_diff_id ut_compound_data_helper.t_hash;
270270
271271 --Variable for dynamic SQL - to review and simplify ??
272- l_table_stmt varchar2(32767) ;
273- l_where_stmt varchar2(32767) ;
274- l_join_by_stmt varchar2(32767) ;
275- l_exec_sql varchar2(32767) ;
276- l_compare_sql varchar2(32767) ;
272+ l_table_stmt clob ;
273+ l_where_stmt clob ;
274+ l_join_by_stmt clob ;
275+ l_exec_sql clob ;
276+ l_compare_sql clob ;
277277
278278 l_other ut_compound_data_value;
279279 l_result integer;
280- --Max rows to prevent out of memory for too much diffs especially on join by non unique
281- l_max_rows integer := greatest(self.elements_count,1000);
282- l_loop_curs sys_refcursor;
283- type t_diff_rec is record (
284- act_item_data clob,
285- act_data_id raw(32),
286- exp_item_data clob,
287- exp_data_id raw(32),
288- item_no integer
289- );
290- type t_diff_tab is table of t_diff_rec;
291- l_diff_tab t_diff_tab;
280+ --We will start with number od differences being displayed.
281+ l_max_rows integer := ut_utils.gc_diff_max_rows;
292282
283+ l_loop_curs sys_refcursor;
284+ l_diff_tab ut_compound_data_helper.t_diff_tab;
285+ l_sql_rowcount integer :=0;
286+
293287 --TEST
294288 t1 pls_integer;
295289
@@ -345,19 +339,24 @@ create or replace type body ut_compound_data_value as
345339 --Pass it to helper as authid as definer
346340 t1 := dbms_utility.get_time;
347341
348- forall idx in 1..l_diff_tab.count
349- insert into ut3.ut_compound_data_diff_tmp
350- ( diff_id, act_item_data, act_data_id, exp_item_data, exp_data_id, item_no )
351- values
352- (l_diff_id, l_diff_tab(idx).act_item_data, l_diff_tab(idx).act_data_id, l_diff_tab(idx).exp_item_data, l_diff_tab(idx).exp_data_id,l_diff_tab(idx).item_no);
353- dbms_output.put_line((dbms_utility.get_time - t1)/100 || ' seconds - get col info');
354- --Exit after first fetch of max rows (to look later)
355- exit;
342+ if (ut_utils.gc_diff_max_rows > l_sql_rowcount ) then
343+ ut_compound_data_helper.insert_diffs_result(l_diff_tab,l_diff_id);
344+ end if;
345+
346+ l_sql_rowcount := l_sql_rowcount + l_diff_tab.count;
347+
348+ if (ut_utils.gc_diff_max_rows <= l_sql_rowcount and l_max_rows != ut_utils.gc_bc_fetch_limit ) then
349+ l_max_rows := ut_utils.gc_bc_fetch_limit;
350+ end if;
351+
352+ dbms_output.put_line((dbms_utility.get_time - t1)/100 || ' seconds - get col info , values'||l_sql_rowcount);
356353 end loop;
357354
355+ --l_actual.set_difference_count(l_sql_rowcount);
356+
358357 --execute immediate l_exec_sql using l_diff_id, self.data_id,l_actual.data_id;
359358 --result is OK only if both are same
360- if sql%rowcount = 0 and self.elements_count = l_other.elements_count then
359+ if l_sql_rowcount = 0 and self.elements_count = l_other.elements_count then
361360 l_result := 0;
362361 else
363362 l_result := 1;
0 commit comments