@@ -146,13 +146,25 @@ create or replace type body ut_cursor_details as
146146
147147 member function get_missing_join_by_columns( a_expected_columns ut_varchar2_list ) return ut_varchar2_list is
148148 l_result ut_varchar2_list;
149+ l_prefix varchar2(125);
149150 begin
151+ if self.is_anydata = 1 then
152+ l_prefix := get_root;
153+ end if;
154+ --regexp_replace(c.access_path,'^\/?([^\/]+\/){1}')
150155 select fl.column_value
151156 bulk collect into l_result
152157 from table(a_expected_columns) fl
153158 where not exists (
154159 select 1 from table(self.cursor_columns_info) c
155- where regexp_like(c.access_path, '^'||fl.column_value||'($|/.*)')
160+ where regexp_like(c.access_path,'^/?'||
161+ case
162+ when self.is_anydata = 1 then
163+ l_prefix||'/'||trim (leading '/' from fl.column_value)
164+ else
165+ fl.column_value
166+ end||'($|/.*)'
167+ )
156168 )
157169 order by fl.column_value;
158170 return l_result;
@@ -162,9 +174,14 @@ create or replace type body ut_cursor_details as
162174 l_result ut_cursor_details := self;
163175 l_column_tab ut_cursor_column_tab := ut_cursor_column_tab();
164176 l_column ut_cursor_column;
177+ l_prefix varchar2(125);
165178 c_xpath_extract_reg constant varchar2(50) := '^((/ROW/)|^(//)|^(/\*/))?(.*)';
166179 begin
167180 if l_result.cursor_columns_info is not null then
181+
182+ if self.is_anydata = 1 then
183+ l_prefix := get_root;
184+ end if;
168185
169186 --limit columns to those on the include items minus exclude items
170187 if a_match_options.include.items.count > 0 then
@@ -181,8 +198,16 @@ create or replace type body ut_cursor_details as
181198 bulk collect into l_result.cursor_columns_info
182199 from table(self.cursor_columns_info) x
183200 where exists(
184- select 1 from included_columns f where regexp_like( x.access_path, '^/?'||f.col_names||'($|/.*)' )
185- );
201+ select 1 from included_columns f where regexp_like(x.access_path,'^/?'||
202+ case
203+ when self.is_anydata = 1 then
204+ l_prefix||'/'||trim(leading '/' from f.col_names)
205+ else
206+ f.col_names
207+ end||'($|/.*)'
208+ )
209+ )
210+ or x.hierarchy_level = case when self.is_anydata = 1 then 1 else 0 end ;
186211 end if;
187212 elsif a_match_options.exclude.items.count > 0 then
188213 with excluded_columns as (
@@ -193,7 +218,13 @@ create or replace type body ut_cursor_details as
193218 bulk collect into l_result.cursor_columns_info
194219 from table(self.cursor_columns_info) x
195220 where not exists(
196- select 1 from excluded_columns f where regexp_like( '/'||x.access_path, '^/?'||f.col_names||'($|/.*)' )
221+ select 1 from excluded_columns f where regexp_like(x.access_path,'^/?'||
222+ case
223+ when self.is_anydata = 1 then
224+ l_prefix||'/'||trim(leading '/' from f.col_names)
225+ else
226+ f.col_names
227+ end||'($|/.*)' )
197228 );
198229 end if;
199230
@@ -226,8 +257,30 @@ create or replace type body ut_cursor_details as
226257 from table(self.cursor_columns_info) t
227258 where (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null)
228259 having count(*) > 0;
229-
230260 return l_result;
231261 end;
262+
263+ member procedure has_anydata(self in out nocopy ut_cursor_details, a_is_anydata in boolean :=false) is
264+ begin
265+ self.is_anydata := case when nvl(a_is_anydata,false) then 1 else 0 end;
266+ end;
267+
268+ member function has_anydata return boolean is
269+ begin
270+ return ut_utils.int_to_boolean(nvl(self.is_anydata,0));
271+ end;
272+
273+ member function get_root return varchar2 is
274+ l_root varchar2(250);
275+ begin
276+ if self.cursor_columns_info.count > 0 then
277+ select x.access_path into l_root from table(self.cursor_columns_info) x
278+ where x.hierarchy_level = 1;
279+ else
280+ l_root := null;
281+ end if;
282+ return l_root;
283+ end;
284+
232285end;
233286/
0 commit comments