@@ -256,12 +256,37 @@ create or replace package body ut_compound_data_helper is
256256 end if;
257257 end;
258258
259+ procedure get_act_and_exp_set(a_current_stmt in out nocopy clob, a_partition_stmt clob, a_select_stmt clob,
260+ a_xmltable_stmt clob, a_unordered boolean,a_type varchar2) is
261+ l_temp_string varchar2(32767);
262+ l_ut_owner varchar2(250) := ut_utils.ut_owner;
263+ begin
264+ ut_utils.append_to_clob(a_current_stmt, a_partition_stmt);
265+
266+ l_temp_string := 'from (select ucd.item_data ';
267+ ut_utils.append_to_clob(a_current_stmt,l_temp_string);
268+ ut_utils.append_to_clob(a_current_stmt, a_select_stmt);
269+
270+ l_temp_string := ',x.data_id, '
271+ || case when not a_unordered then 'position + x.item_no ' else 'rownum ' end
272+ ||'item_no from ' || l_ut_owner || '.ut_compound_data_tmp x,'
273+ ||q'[xmltable('/ROWSET/ROW' passing x.item_data columns ]' ;
274+ ut_utils.append_to_clob(a_current_stmt,l_temp_string);
275+
276+ ut_utils.append_to_clob(a_current_stmt,a_xmltable_stmt);
277+ ut_utils.append_to_clob(a_current_stmt,case when a_xmltable_stmt is null then '' else ',' end||q'[ item_data xmltype PATH '*']');
278+ if not a_unordered then
279+ ut_utils.append_to_clob(a_current_stmt,', POSITION for ordinality ');
280+ end if;
281+ ut_utils.append_to_clob(a_current_stmt,' ) ucd where data_id = :'||a_type||'_guid ) ucd ) ');
282+ end;
283+
284+
259285 function gen_compare_sql(a_inclusion_type boolean, a_is_negated boolean,a_unordered boolean,
260286 a_other ut_data_value_refcursor :=null, a_join_by_list ut_varchar2_list:=ut_varchar2_list() ) return clob is
261287 l_compare_sql clob;
262288 l_temp_string varchar2(32767);
263289
264- l_ut_owner varchar2(250) := ut_utils.ut_owner;
265290 l_xmltable_stmt clob;
266291 l_where_stmt clob;
267292 l_select_stmt clob;
@@ -289,50 +314,12 @@ create or replace package body ut_compound_data_helper is
289314
290315 l_temp_string := 'with exp as ( select ucd.* ';
291316 ut_utils.append_to_clob(l_compare_sql, l_temp_string);
292- ut_utils.append_to_clob (l_compare_sql,l_partition_stmt);
317+ get_act_and_exp_set (l_compare_sql, l_partition_stmt,l_select_stmt, l_xmltable_stmt, a_unordered,'exp' );
293318
294- l_temp_string := 'from (select ucd.item_data ';
295- ut_utils.append_to_clob(l_compare_sql, l_temp_string);
296- ut_utils.append_to_clob(l_compare_sql, l_select_stmt);
297-
298- l_temp_string := ',x.data_id ,'
299- || case when not a_unordered then 'position + x.item_no ' else 'rownum ' end
300- ||'item_no from '|| l_ut_owner || '.ut_compound_data_tmp x, '
301- ||q'[xmltable('/ROWSET/ROW' passing x.item_data columns ]';
302- ut_utils.append_to_clob(l_compare_sql, l_temp_string);
303-
304- ut_utils.append_to_clob(l_compare_sql,l_xmltable_stmt);
305- ut_utils.append_to_clob(l_compare_sql,case when l_xmltable_stmt is null then '' else ',' end||q'[ item_data xmltype PATH '*']');
306-
307- if not a_unordered then
308- ut_utils.append_to_clob(l_compare_sql,', POSITION for ordinality ');
309- end if;
310-
311- l_temp_string := q'[) ucd where data_id = :self_guid ) ucd ) ,]';
312- ut_utils.append_to_clob(l_compare_sql,l_temp_string);
313-
314- l_temp_string :='act as ( select ucd.* ';
319+
320+ l_temp_string :=',act as ( select ucd.* ';
315321 ut_utils.append_to_clob(l_compare_sql, l_temp_string);
316- ut_utils.append_to_clob(l_compare_sql, l_partition_stmt);
317-
318- l_temp_string := 'from (select ucd.item_data ';
319- ut_utils.append_to_clob(l_compare_sql,l_temp_string);
320- ut_utils.append_to_clob(l_compare_sql, l_select_stmt);
321-
322- l_temp_string := ',x.data_id, '
323- || case when not a_unordered then 'position + x.item_no ' else 'rownum ' end
324- ||'item_no from ' || l_ut_owner || '.ut_compound_data_tmp x,'
325- ||q'[xmltable('/ROWSET/ROW' passing x.item_data columns ]' ;
326- ut_utils.append_to_clob(l_compare_sql,l_temp_string);
327-
328- ut_utils.append_to_clob(l_compare_sql,l_xmltable_stmt);
329- ut_utils.append_to_clob(l_compare_sql,case when l_xmltable_stmt is null then '' else ',' end||q'[ item_data xmltype PATH '*']');
330-
331- if not a_unordered then
332- ut_utils.append_to_clob(l_compare_sql,', POSITION for ordinality ');
333- end if;
334-
335- ut_utils.append_to_clob(l_compare_sql,q'[ ) ucd where data_id = :other_guid ) ucd ) ]');
322+ get_act_and_exp_set(l_compare_sql, l_partition_stmt,l_select_stmt, l_xmltable_stmt, a_unordered,'act');
336323
337324 l_temp_string := ' select a.item_data as act_item_data, a.data_id act_data_id,'
338325 ||'e.item_data as exp_item_data, e.data_id exp_data_id, '||
0 commit comments