@@ -91,41 +91,44 @@ create or replace package body ut_compound_data_helper is
9191 l_results tt_column_diffs;
9292 begin
9393 l_column_filter := get_columns_row_filter(a_exclude_xpath, a_include_xpath);
94+ --CARDINALITY hints added to address issue: https://github.com/utPLSQL/utPLSQL/issues/752
9495 l_sql := q'[
9596 with
9697 expected_cols as ( select :a_expected as item_data from dual ),
9798 actual_cols as ( select :a_actual as item_data from dual ),
98- expected_cols_info as (
99+ expected_cols_info as (
99100 select e.*,
100101 replace(expected_type,'VARCHAR2','CHAR') expected_type_compare
101102 from (
102- SELECT rownum expected_pos,
103- xt.name expected_name,
104- xt.type expected_type
105- FROM (select ]'||l_column_filter||q'[ from expected_cols ucd) x,
106- XMLTABLE('/ROW/*'
107- PASSING x.item_data
108- COLUMNS
109- name VARCHAR2(4000) PATH '@xml_valid_name',
110- type VARCHAR2(4000) PATH '/'
111- ) xt
112- ) e
103+ select /*+ CARDINALITY(xt 100) */
104+ rownum expected_pos,
105+ xt.name expected_name,
106+ xt.type expected_type
107+ from (select ]'||l_column_filter||q'[ from expected_cols ucd) x,
108+ xmltable(
109+ '/ROW/*'
110+ passing x.item_data
111+ columns
112+ name varchar2(4000) PATH '@xml_valid_name',
113+ type varchar2(4000) PATH '/'
114+ ) xt
115+ ) e
113116 ),
114117 actual_cols_info as (
115118 select a.*,
116119 replace(actual_type,'VARCHAR2','CHAR') actual_type_compare
117- from (
118- SELECT rownum actual_pos,
119- xt.name actual_name,
120- xt.type actual_type
121- FROM (select ]'||l_column_filter||q'[ from actual_cols ucd) x,
122- XMLTABLE ('/ROW/*'
123- PASSING x.item_data
124- COLUMNS
125- name VARCHAR2 (4000) PATH '@xml_valid_name',
126- type VARCHAR2 (4000) PATH '/'
127- ) xt
128- ) a
120+ from (select /*+ CARDINALITY(xt 100) */
121+ rownum actual_pos,
122+ xt.name actual_name,
123+ xt.type actual_type
124+ from (select ]'||l_column_filter||q'[ from actual_cols ucd) x,
125+ xmltable ('/ROW/*'
126+ passing x.item_data
127+ columns
128+ name varchar2 (4000) path '@xml_valid_name',
129+ type varchar2 (4000) path '/'
130+ ) xt
131+ ) a
129132 ),
130133 joined_cols as (
131134 select e.*, a.*,
0 commit comments