ORA-00917-缺少逗号

时间:2013-03-05 09:11:44

标签: oracle

SELECT 
    XMLELEMENT (
        DECODE ('RF', 'RF', 'Credit', 'Sale'), xmlattributes ('01234567' AS "id")
    ) AS Order
FROM 
    DUAL

当我运行上述查询时,我收到ORA-00917-missing coma错误。

1 个答案:

答案 0 :(得分:1)

不确定您要执行的操作,但如果您需要动态元素名称,则需要使用EVALNAME

SELECT 
    XMLELEMENT (
          evalname(       
        DECODE ('RF', 'RF', 'Credit', 'Sale')),
      xmlattributes ('01234567' AS "id")
    ).getstringval() AS "Order"
FROM 
    DUAL

Here is a sqlfiddle demo