我有一个带有 nvl 和 case 语句的 SQL,必须将其转换为 Informatica 表达式
I have a SQL with nvl and case statement that has to be converted into Informatica expression
我有以下 SQL 声明:
nvl(W_SALES_INVOICE_LINE_FS.INVOICED_QTY,
case nvl(W_SALES_INVOICE_LINE_FS.NET_AMT,0) when 0 then W_SALES_INVOICE_LINE_FS.INVOICED_QTY
else -1 end)
有人可以帮助我使用 ISNULL 和 DECODE() 将其转换为 Informatica 表达式。我尝试了以下并给出了解析错误:
IIF(ISNULL(EXT_INVOICED_QTY),
DECODE(EXT_NET_AMOUNT, IIF(ISNULL(EXT_NET_AMOUNT),0,EXT_NET_AMOUNT) =0, EXT_INVOICED_QTY, -1),
EXT_INVOICED_QTY)
注意事项:
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = EXT_INVOICED_QTY
W_SALES_INVOICE_LINE_FS.NET_AMT = EXT_NET_AMOUNT
您的 SQL 声明有点奇怪。我们来分析一下:
W_SALES_INVOICE_LINE_FS.INVOICED_QTY != NULL => W_SALES_INVOICE_LINE_FS.INVOICED_QTY
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = NULL AND W_SALES_INVOICE_LINE_FS.NET_AMT = NULL => W_SALES_INVOICE_LINE_FS.INVOICED_QTY (but it's NULL)
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = NULL AND W_SALES_INVOICE_LINE_FS.NET_AMT != NULL = > -1
看来你只需要有完全相同的输出:
DECODE ( TRUE,
NOT isNULL( EXT_INVOICED_QTY ), EXT_INVOICED_QTY ,
isNULL(EXT_NET_AMT), NULL,
-1)
下面使用DECODE函数来return你想要的
Link 如果您对 DECODE 有任何疑问:http://forgetcode.com/Informatica/1057-Decode-Value-Search-or-Nested-If-Else
DECODE (TRUE,
NOT isNULL(EXT_INVOICED_QTY), EXT_INVOICED_QTY,
isNULL(EXT_NET_AMT), NULL,
-1)
祝你好运!
我有以下 SQL 声明:
nvl(W_SALES_INVOICE_LINE_FS.INVOICED_QTY,
case nvl(W_SALES_INVOICE_LINE_FS.NET_AMT,0) when 0 then W_SALES_INVOICE_LINE_FS.INVOICED_QTY
else -1 end)
有人可以帮助我使用 ISNULL 和 DECODE() 将其转换为 Informatica 表达式。我尝试了以下并给出了解析错误:
IIF(ISNULL(EXT_INVOICED_QTY),
DECODE(EXT_NET_AMOUNT, IIF(ISNULL(EXT_NET_AMOUNT),0,EXT_NET_AMOUNT) =0, EXT_INVOICED_QTY, -1),
EXT_INVOICED_QTY)
注意事项:
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = EXT_INVOICED_QTY W_SALES_INVOICE_LINE_FS.NET_AMT = EXT_NET_AMOUNT
您的 SQL 声明有点奇怪。我们来分析一下:
W_SALES_INVOICE_LINE_FS.INVOICED_QTY != NULL => W_SALES_INVOICE_LINE_FS.INVOICED_QTY
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = NULL AND W_SALES_INVOICE_LINE_FS.NET_AMT = NULL => W_SALES_INVOICE_LINE_FS.INVOICED_QTY (but it's NULL)
W_SALES_INVOICE_LINE_FS.INVOICED_QTY = NULL AND W_SALES_INVOICE_LINE_FS.NET_AMT != NULL = > -1
看来你只需要有完全相同的输出:
DECODE ( TRUE,
NOT isNULL( EXT_INVOICED_QTY ), EXT_INVOICED_QTY ,
isNULL(EXT_NET_AMT), NULL,
-1)
下面使用DECODE函数来return你想要的
Link 如果您对 DECODE 有任何疑问:http://forgetcode.com/Informatica/1057-Decode-Value-Search-or-Nested-If-Else
DECODE (TRUE,
NOT isNULL(EXT_INVOICED_QTY), EXT_INVOICED_QTY,
isNULL(EXT_NET_AMT), NULL,
-1)
祝你好运!