0

Oracleで次のSQLクエリがあります。

SELECT pr.uuid AS masterproductid, 
            (case 
                when xmltype(pr.attributes_de_de).extract('//attr[@name = "SellingPoint1"]/string/text()') IS NOt NULL THEN 'sellingpoint1'
                when xmltype(pr.attributes_de_de).extract('//attr[@name = "SellingPoint2"]/string/text()') IS NOt NULL THEN 'sellingpoint2'
            END
            ) as testt
  FROM product pr WHERE pr.defaultproductvariationid =(SELECT prv.uuid FROM  productvariation prv WHERE  prv.uuid = '3rep_vEBP6IAAAE83REjnPbb' AND pr.typecode='16')

「sellingpoint1」と「sellingpoint2」の両方が null ではなく、このクエリが Sellingpoint1 のみを返す場合、「sellingpoint2」も必要ですが、どうすればそれを取得できますか?

手伝ってくれてありがとう

4

1 に答える 1

0

これにより、2 つの列に配置されます。

SELECT pr.uuid AS masterproductid, 
            (case when xmltype(pr.attributes_de_de).extract('//attr[@name = "SellingPoint1"]/string/text()') IS NOt NULL
                 THEN 'sellingpoint1'
             end) as testsellingpoint1,
            (case when xmltype(pr.attributes_de_de).extract('//attr[@name = "SellingPoint2"]/string/text()') IS NOt NULL
                  THEN 'sellingpoint2'
             END
            ) as testsellingpoint2
  FROM product pr WHERE pr.defaultproductvariationid =(SELECT prv.uuid FROM  productvariation prv WHERE  prv.uuid = '3rep_vEBP6IAAAE83REjnPbb' AND pr.typecode='16')
于 2013-02-22T14:09:43.183 に答える