'xml columns and keep dense_rank' problem
730990Mar 2 2010 — edited Mar 3 2010Hi all!
I have some problem with querying xml data.
Simplified description follows:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production - Linux
I have 3 rows:
a x
1 <a>1</a>
2 <a>2</a>
3 <a>3</a>
and want to have
a x x1
1 <a>1</a> <a>1</a>
2 <a>2</a> <a>1</a>
3 <a>3</a> <a>1</a>
as a result.
This query
with d0 as (
* select 1 a, xmlelement("a", 1) x from dual*
* union all select 2 a, xmlelement("a", 2) x from dual*
* union all select 3 a, xmlelement("a", 3) x from dual*
*)*
select a, x, xmlconcat(x) keep (dense_rank first order by a) over (partition by 0) x1
* from d0;*
throws
ORA-03113: ....
What am I doing wrong? Or is it a bug?
Is it possible to get result not using query like this:
with d0 as (
* select 1 a, xmlelement("a", 1) x from dual*
* union all select 2 a, xmlelement("a", 2) x from dual*
* union all select 3 a, xmlelement("a", 3) x from dual*
*)*
select a, x, (select x from d0 where a = 1) x1
* from d0;*
Thank you!