The use of operators AND / or / NOT or functions depends only on your task,and the complexity of the processing logic you need to implement.
Can explain what is your question?
1. Using XML in SQL
1) Why you use anonymous pl/sql block in IF-statement?
2) This line "IF INSTR( vstrout,'&') " is contain not escaped char
Are you need stored source of xml documents?
Task could be solved of a few path: by shell scripts and (sqlplus or sql loader), simple of...
How complex a document you plan to create : with XSD scheme or not ?
For an example , to support database environments development, test, you can use "thin clones" or tools (ODI,OGG,...) or manual copy if your db is...
1) For Orace: HS
2) For MS SQL:
if you'll have some question, then write here.
For education :
select dummy from dual;
Provide here your source code of the procedure MYPROC.SCHED_SQL_QUERY
select listagg(column_expression, ', ') within group (order by column_position)
if you just need to collect a branch from the child to the parent, you do not need to scan "all parents"
for a example....,'11114' '44442'...
parents at what level do you need to compare?
also,provide here INSERT statements for you table.
For a start:
1) change notification or dbms_scheduler
List the examples
CREATE TABLE test_ext