@@ -96,6 +96,7 @@ create or replace type body ut_cursor_details as
9696 l_hierarchy_level integer := 1;
9797 begin
9898 self.cursor_columns_info := ut_cursor_column_tab();
99+ self.is_anydata := 0;
99100 dbms_sql.describe_columns3(a_cursor_number, l_columns_count, l_columns_desc);
100101
101102 /**
@@ -147,12 +148,13 @@ create or replace type body ut_cursor_details as
147148 member function get_missing_join_by_columns( a_expected_columns ut_varchar2_list ) return ut_varchar2_list is
148149 l_result ut_varchar2_list;
149150 begin
151+ --regexp_replace(c.access_path,'^\/?([^\/]+\/){1}')
150152 select fl.column_value
151153 bulk collect into l_result
152154 from table(a_expected_columns) fl
153155 where not exists (
154156 select 1 from table(self.cursor_columns_info) c
155- where regexp_like(c.access_path, '^ '||fl.column_value||'($|/.*)')
157+ where regexp_like(c.filter_path,'^/? '||fl.column_value||'($|/.*)' )
156158 )
157159 order by fl.column_value;
158160 return l_result;
@@ -181,8 +183,9 @@ create or replace type body ut_cursor_details as
181183 bulk collect into l_result.cursor_columns_info
182184 from table(self.cursor_columns_info) x
183185 where exists(
184- select 1 from included_columns f where regexp_like( x.access_path, '^/?'||f.col_names||'($|/.*)' )
185- );
186+ select 1 from included_columns f where regexp_like(x.filter_path,'^/?'||f.col_names||'($|/.*)' )
187+ )
188+ or x.hierarchy_level = case when self.is_anydata = 1 then 1 else 0 end ;
186189 end if;
187190 elsif a_match_options.exclude.items.count > 0 then
188191 with excluded_columns as (
@@ -193,7 +196,7 @@ create or replace type body ut_cursor_details as
193196 bulk collect into l_result.cursor_columns_info
194197 from table(self.cursor_columns_info) x
195198 where not exists(
196- select 1 from excluded_columns f where regexp_like( '/'||x.access_path, '^/?'||f.col_names||'($|/.*)' )
199+ select 1 from excluded_columns f where regexp_like(x.filter_path, '^/?'||f.col_names||'($|/.*)' )
197200 );
198201 end if;
199202
@@ -226,8 +229,28 @@ create or replace type body ut_cursor_details as
226229 from table(self.cursor_columns_info) t
227230 where (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null)
228231 having count(*) > 0;
229-
230232 return l_result;
231233 end;
234+
235+ member function get_root return varchar2 is
236+ l_root varchar2(250);
237+ begin
238+ if self.cursor_columns_info.count > 0 then
239+ select x.access_path into l_root from table(self.cursor_columns_info) x
240+ where x.hierarchy_level = 1;
241+ else
242+ l_root := null;
243+ end if;
244+ return l_root;
245+ end;
246+
247+ member procedure strip_root_from_anydata(self in out nocopy ut_cursor_details) is
248+ l_root varchar2(250) := get_root();
249+ begin
250+ self.is_anydata := 1;
251+ for i in 1..cursor_columns_info.count loop
252+ self.cursor_columns_info(i).filter_path := '/'||ut_utils.strip_prefix(self.cursor_columns_info(i).access_path,l_root);
253+ end loop;
254+ end;
232255end;
233256/
0 commit comments