当字段数据包含单引号时,如何在 IICS 中使用解码?
How to use decode in IICS when field data contain single quote?
我是 IICS
的新手,我想要解码的字段如下所示。如您所见,“Outlet_Name”列包含行“NH D'needs”。我的要求是使用两列,即 Outlet_name 和部门,并生成一个由整数组成的输出字段调用“OD_ID”。所以 Decode
将如下所示。但是,当我 运行 在解码表达式下方时,我收到验证错误,提示缺少运算符。我相信这与“NH D'needs”中 D 和需求之间的单引号有关。不确定如何从这里开始?
提前感谢您的时间和努力!
IICS解码码
DECODE(True,
Outlet_Name = 'NH D'needs' AND Department ='Marketing' , 1,
Outlet_Name = 'NH Mart' AND Department ='Finance' ,2,
Outlet_Name = 'NH Groceries' AND Department ='Inventory' ,3,
Outlet_Name= 'NH Lifestyle' AND Department ='Marketing' , 4,
Outlet_Name = 'NH Digital' AND Department ='Logistics' , 5,
0
)
请使用 CHR(39)
创建单引号。以下应该有效。
DECODE(True,
Outlet_Name = 'NH D'|| CHR(39)||'needs' AND Department ='Marketing' , 1,
Outlet_Name = 'NH Mart' AND Department ='Finance' ,2,
Outlet_Name = 'NH Groceries' AND Department ='Inventory' ,3,
Outlet_Name= 'NH Lifestyle' AND Department ='Marketing' , 4,
Outlet_Name = 'NH Digital' AND Department ='Logistics' , 5,
0
)
我是 IICS
的新手,我想要解码的字段如下所示。如您所见,“Outlet_Name”列包含行“NH D'needs”。我的要求是使用两列,即 Outlet_name 和部门,并生成一个由整数组成的输出字段调用“OD_ID”。所以 Decode
将如下所示。但是,当我 运行 在解码表达式下方时,我收到验证错误,提示缺少运算符。我相信这与“NH D'needs”中 D 和需求之间的单引号有关。不确定如何从这里开始?
提前感谢您的时间和努力!
IICS解码码
DECODE(True,
Outlet_Name = 'NH D'needs' AND Department ='Marketing' , 1,
Outlet_Name = 'NH Mart' AND Department ='Finance' ,2,
Outlet_Name = 'NH Groceries' AND Department ='Inventory' ,3,
Outlet_Name= 'NH Lifestyle' AND Department ='Marketing' , 4,
Outlet_Name = 'NH Digital' AND Department ='Logistics' , 5,
0
)
请使用 CHR(39)
创建单引号。以下应该有效。
DECODE(True,
Outlet_Name = 'NH D'|| CHR(39)||'needs' AND Department ='Marketing' , 1,
Outlet_Name = 'NH Mart' AND Department ='Finance' ,2,
Outlet_Name = 'NH Groceries' AND Department ='Inventory' ,3,
Outlet_Name= 'NH Lifestyle' AND Department ='Marketing' , 4,
Outlet_Name = 'NH Digital' AND Department ='Logistics' , 5,
0
)