我正在尝试获取Oracle case语句的else部分以返回设置的字符串值;栏位1是NVARCHAR2(255 CHAR)
select case when substr(field1, 10, 1) = 'x'
then substr(field1, 9, 3)
else '---'
end Data
from table a
数据示例
Row field1
1 Current 1x1 Cost
2 Current Cost
3 Current 1x1 Efficiency
4 Current Efficiency
5 Current 1x1 CostB
6 Current CostB
我想退货
Row Data
1 1x1
2 ---
3 1x1
4 ---
5 1x1
6 ---
尝试投---
以NVARCHAR2
如下
select case when substr(field1, 10, 1) = 'x'
then substr(field1, 9, 3)
else cast('---' as NVARCHAR2(255))
end Data
from tab a
现在,evry值返回相同类型的数据
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句