-1

How do we write IIF condition in Oracle.

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

I need to convert the above IIF into ORACLE but am unable to do so. How do we go forward with this.

Jatin Bhatia
  • 248
  • 4
  • 15

1 Answers1

1

Similar to this:

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

Obviously the xml datatype works differently in Oracle than Microsoft.

casenonsensitive
  • 955
  • 2
  • 9
  • 18
  • 1
    decode(ItemType, '-1' , (Select EXTRACTVALUE(xmltype(ConfigXml), '/configurations/config/itemtypeid') from EmailCaptureConfig where OwnerID = 142 and ConfigID = 1), ActionObjecttype) as ActionObject, – Jatin Bhatia Jul 08 '20 at 13:50