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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

count() in XMLExists don't work

MaikRJan 10 2018 — edited Jan 10 2018

Hello @all, on Oracle 12.2.0.1: I need a query as follows: SELECT XMLSERIALIZE(CONTENT t.po AS varchar2(1000) INDENT SIZE=2) inhalt,       XMLCAST(XMLQUERY('count(//itemNo)' PASSING po RETURNING CONTENT) AS NUMBER) cntItems1,       XMLCAST(XMLQUERY('count(/purchaseOrder/itemNo)' PASSING po RETURNING CONTENT) AS NUMBER) cntItems2 FROM ( SELECT XMLPARSE(CONTENT '   1  2  3  ' WELLFORMED ) AS PO FROM DUAL) t WHERE --XMLEXISTS('/purchaseOrder/*[count(itemNo)>0]' PASSING po) --don't work                 XMLEXISTS('//*[count(itemNo)>2]' PASSING po) ---work The problem is as follows: I don't get any rows if i use the first xmlexists() in the where clause, whereas the second works! The difference is only th xpath expression. But both xpath expressions works in xmlquery() in the select list! So my question is: Why the first xpath in xmlexists() don't work? By the way: I get an ORA-21500 (internal error) [%s],[%s],[%s],[%s],[%s],[%s], with the following stmt: SELECT XMLPARSE(CONTENT '' ) FROM DUAL whereas this runs: SELECT XMLPARSE(CONTENT '' WELLFORMED) FROM DUAL WELLFORMED is an optional parameter! Thanks for your support! Maik

This post has been answered by Paulzip on Jan 10 2018
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 7 2018
Added on Jan 10 2018
16 comments
487 views