@@ -109,9 +109,9 @@ create or replace type body ut_data_value_refcursor as
109109 l_result_string varchar2(32767);
110110 begin
111111 if not self.is_null() then
112- dbms_lob.createtemporary(l_result,true);
113- ut_utils.append_to_clob(l_result,'Data-types:'||chr(10));
114- ut_utils.append_to_clob(l_result,self.columns_info.getclobval());
112+ dbms_lob.createtemporary(l_result, true);
113+ ut_utils.append_to_clob(l_result, 'Data-types:'||chr(10));
114+ ut_utils.append_to_clob(l_result, self.columns_info.getclobval());
115115
116116 ut_utils.append_to_clob(l_result,chr(10)||'Data:'||chr(10));
117117 --return first c_max_rows rows
@@ -187,6 +187,21 @@ create or replace type body ut_data_value_refcursor as
187187 l_ut_owner varchar2(250) := ut_utils.ut_owner;
188188 l_column_filter varchar2(32767);
189189 l_diff_id raw(16);
190+ --the XML stylesheet is applied on XML representation of data to exclude column names from comparison
191+ --column names and data-types are compared separately
192+ l_xml_data_fmt constant xmltype := xmltype(
193+ q'[<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
194+ <xsl:strip-space elements="*" />
195+ <xsl:template match="/child::*">
196+ <xsl:for-each select="child::node()">
197+ <xsl:choose>
198+ <xsl:when test="*[*]"><xsl:copy-of select="node()"/></xsl:when>
199+ <xsl:when test="position()=last()"><xsl:value-of select="normalize-space(.)"/><xsl:text>
</xsl:text></xsl:when>
200+ <xsl:otherwise><xsl:value-of select="normalize-space(.)"/>,</xsl:otherwise>
201+ </xsl:choose>
202+ </xsl:for-each>
203+ </xsl:template>
204+ </xsl:stylesheet>]');
190205 function columns_hash(
191206 a_data_value_cursor ut_data_value_refcursor, a_exclude_xpath varchar2, a_include_xpath varchar2
192207 ) return raw is
@@ -225,9 +240,16 @@ create or replace type body ut_data_value_refcursor as
225240 full outer join
226241 (select '||l_column_filter||', ucd.item_no
227242 from ' || l_ut_owner || '.ut_data_set_tmp ucd where ucd.data_set_guid = :l_other_guid) act
228- on exp.item_no = act.item_no
229- where nvl(dbms_lob.compare(xmlserialize( content exp.item_data no indent), xmlserialize( content act.item_data no indent)),1) != 0'
230- using in l_diff_id, a_exclude_xpath, a_include_xpath, self.data_set_guid, a_exclude_xpath, a_include_xpath, l_other.data_set_guid;
243+ on exp.item_no = act.item_no '||
244+ -- 'where nvl(dbms_lob.compare(xmlserialize( content exp.item_data no indent), xmlserialize( content act.item_data no indent)),1) != 0'
245+ -- using in l_diff_id, a_exclude_xpath, a_include_xpath, self.data_set_guid, a_exclude_xpath, a_include_xpath, l_other.data_set_guid;
246+ 'where nvl( dbms_lob.compare(' ||
247+ ' xmltransform(exp.item_data, :l_xml_data_fmt).getclobval()' ||
248+ ', xmltransform(act.item_data, :l_xml_data_fmt).getclobval())' ||
249+ ',1' ||
250+ ') != 0'
251+ using in l_diff_id, a_exclude_xpath, a_include_xpath, self.data_set_guid,
252+ a_exclude_xpath, a_include_xpath, l_other.data_set_guid, l_xml_data_fmt, l_xml_data_fmt;
231253
232254 --result is OK only if both are same
233255 if sql%rowcount = 0 and self.row_count = l_other.row_count and l_result = 0 then
0 commit comments