这是一段我希望能够用PL/SQL重写的TSQL代码示例。
DECLARE @xml XML
SET @xml = '<theRange>
<theRow><First>Bob</First><Last>Smith</Last><Age>30</Age></theRow>
<theRow><First>Sue</First><Last>Jones</Last><Age>34</Age></theRow>
<theRow><First>John</First><Last>Bates</Last><Age>40</Age></theRow>
</theRange>'
;WITH OpenedXML AS (
SELECT r.value('First[1]','varchar(50)') AS First,
r.value('Last[1]','varchar(50)') AS Last,
r.value('Age[1]','int') AS Age
FROM @xml.nodes('//theRange/theRow') AS Row(r)
)
SELECT *
FROM OpenedXML
WHERE Age BETWEEN 30 AND 35
Can anyone give me some direction here.