Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLAGG function

vikram (959352)Jun 19 2015 — edited Jun 19 2015

Hello All,

Database version : Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

Query 1:

select xmlelement(test,dummy).extract('//text()').getclobval()

from dual

where 1=2;

Query 2:

select xmlagg(xmlelement(e,dummy)).extract('//text()').getclobval()

from dual

where 1= 2;

Please help me to understand the above two queries. As query 1 gives no row (cause of where clause) where as query 2 produces one null row.

As per my understanding of the order of sql-execution (FROM => WHERE => SELECT), SELECT clause gets executed for filtered rows. then why the above two produces different result.

I tried to read about XMLAGG but am not able to understand this case.

I appreciate your support!

Thanks

Vikram

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2015
Added on Jun 19 2015
1 comment
327 views