【问题标题】:How to write IIF condition in Oracle [duplicate]如何在Oracle中编写IIF条件[重复]
【发布时间】:2020-07-08 13:13:59
【问题描述】:

我们如何在 Oracle 中编写 IIF 条件。

IIF(ItemType = '-1' , (Select CAST(CAST(ConfigXml as XML).query('data(/configurations/config/itemtypeid)') as nvarchar (64)) from EmailCaptureConfig where OwnerID = 142 and ConfigID = 1), ActionObjecttype) as ActionObject

我需要将上述 IIF 转换为 ORACLE,但我无法这样做。我们将如何进行。

【问题讨论】:

    标签: ssms oracle-sqldeveloper


    【解决方案1】:

    与此类似:

    decode(ItemType, '-1' , (Select CAST(CAST(ConfigXml as XML).query('data(/configurations/config/itemtypeid)') as nvarchar (64)) from EmailCaptureConfig where OwnerID = 142 and ConfigID = 1), ActionObjecttype) as ActionObject
    

    显然 xml 数据类型在 Oracle 中的工作方式与 Microsoft 不同。

    【讨论】:

    • decode(ItemType, '-1' , (Select EXTRACTVALUE(xmltype(ConfigXml), '/configurations/config/itemtypeid') from EmailCaptureConfig where OwnerID = 142 and ConfigID = 1), ActionObjecttype) as动作对象,
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-24
    • 2010-12-25
    • 1970-01-01
    • 2011-07-05
    • 1970-01-01
    • 2011-12-23
    相关资源
    最近更新 更多