select * from (
SELECT t.id,
rownum,w.DFNAME,w.DFGUID,x.TGUID,x.NAME,x.TYPE,'DIUIOptions' as TYPE1,y.ATTR,y.value
FROM xmltests t,
XMLTABLE ('./*'
PASSING t.data
COLUMNS DFNAME VARCHAR2(30) PATH '@name',
DFGUID VARCHAR2(30) PATH '@id'
)W,
XMLTABLE ('//DIQuery'
PASSING t.data
COLUMNS TGUID VARCHAR2(30) PATH '@GUID',
NAME varchar2(30) path '//DIQuery/*/@name',
TYPE varchar2(30) path 'name()',
XPATH XMLTYPE PATH '//*')X,
XMLTABLE ('//DIQuery/DIUIOptions/*'
PASSING x.XPATH
COLUMNS ATTR VARCHAR2(30) PATH '@name',
VALUE VARCHAR2(30) PATH '@value'
)Y
union all
SELECT t.id,
rownum, w.DFNAME,w.DFGUID,x.TGUID,x.NAME,x.TYPE,'DISchema' as TYPE1,y.ATTR,y.datatype||' '||y."SIZE"
FROM xmltests t,
XMLTABLE ('./*'
PASSING t.data
COLUMNS DFNAME VARCHAR2(30) PATH '@name',
DFGUID VARCHAR2(30) PATH '@id'
)W,
XMLTABLE ('//DIQuery'
PASSING t.data
COLUMNS TGUID VARCHAR2(30) PATH '@GUID',
NAME varchar2(30) path '//DIQuery/*/@name',
TYPE varchar2(30) path 'name()',
XPATH XMLTYPE PATH '//*')X,
XMLTABLE ('//DIQuery/DISchema/*'
PASSING x.XPATH
COLUMNS ATTR VARCHAR2(30) PATH '@name',
datatype VARCHAR2(30) PATH '@datatype',
"SIZE" VARCHAR2(30) PATH '@size'
)Y
union all
SELECT t.id,
rownum,w.DFNAME,w.DFGUID,x.TGUID,x.NAME,x.TYPE,'DISelect' as TYPE1,y.typez,nvl(y.ATTR,y.qualifier)||'-'||y.expr
FROM xmltests t,
XMLTABLE ('./*'
PASSING t.data
COLUMNS DFNAME VARCHAR2(30) PATH '@name',
DFGUID VARCHAR2(30) PATH '@id'
)W,
XMLTABLE ('//DIQuery'
PASSING t.data
COLUMNS TGUID VARCHAR2(30) PATH '@GUID',
NAME varchar2(30) path '//DIQuery/*/@name',
TYPE varchar2(30) path 'name()',
XPATH XMLTYPE PATH '//*')X,
XMLTABLE ('//DIQuery/DISelect//DIExpression|//DIQuery/DISelect//DIExpression/*'
PASSING x.XPATH
COLUMNS ATTR VARCHAR2(30) PATH '@isString',
expr VARCHAR2(30) PATH '@expr',
qualifier VARCHAR2(30) PATH '@qualifier1',
TYPEZ varchar2(30) path 'name()'
)Y
union all
SELECT t.id,
rownum,w.DFNAME,w.DFGUID,x.TGUID,x.NAME,x.TYPE,'DIAttributes' as TYPE1,y.ATTR,y.value
FROM xmltests t,
XMLTABLE ('./*'
PASSING t.data
COLUMNS DFNAME VARCHAR2(30) PATH '@name',
DFGUID VARCHAR2(30) PATH '@id'
)W,
XMLTABLE ('//DIQuery'
PASSING t.data
COLUMNS TGUID VARCHAR2(30) PATH '@GUID',
NAME varchar2(30) path '//DIQuery/*/@name',
TYPE varchar2(30) path 'name()',
XPATH XMLTYPE PATH '//*')X,
XMLTABLE ('//DIQuery/DIAttributes/*'
PASSING x.XPATH
COLUMNS ATTR VARCHAR2(30) PATH '@name',
VALUE VARCHAR2(30) PATH '@value'
)Y where t.ID = 1
)
order by Tguid,rownum
No comments:
Post a Comment