Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c3d320

Browse files
committed
Fixing issue when a hash was tried to be generated on the null value from XML extract causing to fail. Please see #1098
Resolve a situation where a more than two levels of nesting were causing ambiguity on the column name for hash. E.g. <OBJ1><FIRST><VAL><TEST> <OBJ1><SECOND><VAL><TEST> Was taking into hash consideration only parent.
1 parent 5e983a8 commit 3c3d320

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

source/core/ut_utils.pkb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,12 +882,14 @@ create or replace package body ut_utils is
882882

883883
function get_hash(a_data raw, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash is
884884
begin
885-
return dbms_crypto.hash(a_data, a_hash_type);
885+
--We cannot run hash on null
886+
return case when a_data is null then null else dbms_crypto.hash(a_data, a_hash_type) end;
886887
end;
887888

888889
function get_hash(a_data clob, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash is
889890
begin
890-
return dbms_crypto.hash(a_data, a_hash_type);
891+
--We cannot run hash on null
892+
return case when a_data is null then null else dbms_crypto.hash(a_data, a_hash_type) end;
891893
end;
892894

893895
function qualified_sql_name(a_name varchar2) return varchar2 is

source/expectations/data_values/ut_cursor_column.tpb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ create or replace type body ut_cursor_column as
2828
a_access_path||'/'||self.xml_valid_name
2929
end; --Access path used for XMLTABLE query
3030
self.filter_path := '/'||self.access_path; --Filter path will differ from access path in anydata type
31+
--Transformed name needs to be build on full access path to avoid ambiguity when there is 3 or more levels of nesting.
3132
self.transformed_name := case when length(self.xml_valid_name) > 30 then
32-
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
33+
'"'||ut_compound_data_helper.get_fixed_size_hash(self.access_path)||'"'
3334
when self.parent_name is null then
3435
'"'||self.xml_valid_name||'"'
3536
else
36-
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
37+
'"'||ut_compound_data_helper.get_fixed_size_hash(self.access_path)||'"'
3738
end; --when is nestd we need to hash name to make sure we dont exceed 30 char
3839
self.column_type := a_col_type; --column type e.g. user_defined , varchar2
3940
self.column_schema := a_col_schema_name; -- schema name

0 commit comments

Comments
 (0)