Skip to Main Content

Database Software

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!

Help with counting XML elements and converting from MS SQL 2008 to ORACLE

946786Jun 30 2012 — edited Jul 2 2012
Hello,

My ORACLE DB version is:

('Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production');
('PL/SQL Release 11.2.0.2.0 - Production');
('CORE 11.2.0.2.0 Production');
('TNS for Linux: Version 11.2.0.2.0 - Production');
('NLSRTL Version 11.2.0.2.0 - Production');

I'm trying to convert the below SQL Server 2008 query to work on Oracle. It's important to note that the XMLData column type is CLOB.

Query 1)
-- Number of validations
select br.rulename, CAST(( CAST(br.XMLData as XML)).query('count(//Validation/Expressions/Expression)') as nvarchar(50)) as "Number of //Validation/Expressions/Expression"
from AsBusinessRules br
where
DATALENGTH(br.XMLData)>10
and CAST(( CAST(br.XMLData as XML)).query('count(//Validation/Expressions/Expression)') as nvarchar(50)) not like '0'

Any help is greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2012
Added on Jun 30 2012
5 comments
475 views