Converting a SQL statement to PL/SQL (Oracle) having WITH and AS XML



I have a query that I need to see if can be converted to Oracle



with Cte as (select cast('<S>' + replace(replace(N'$(AppServers)', ';', ','), ',', '</S><S>') + '</S>' as XML) AS Servers)
insert into INSTANCE (INSTANCE_ID, SERVER_NAME, INSTANCE_IDENTIFIER, IDENTIFIER_PREFIX) select ROW_NUMBER() over (order by SERVER_NAME) - 1, SERVER_NAME, null, 0 from (
select distinct upper(Split.Server.value('.', 'VARCHAR(100)')) as SERVER_NAME from Cte cross apply Servers.nodes('/S') Split(Server)) Servers
order by SERVER_NAME;


I know Oracle 11g has dedicated support for XML but I cannot find my way around this one. Any help is greatly appreciated.


No comments:

Post a Comment