读书人

db2 数据类型转化有关问题

发布时间: 2012-02-21 16:26:23 作者: rapoo

db2 数据类型转化问题
select case char(DivisionLineValue)
when '0999999999.00 '
then StandByTwo
else char(DivisionLineValue)
end from RIDivisionLineDef


查出来的数据是
0000400000.00
0000600000.00
MaxLimit

DivisionLineValue 是 decimal 类型 StandByTwo 是 varchar类型

现在想要做的 是让 查出来的结果是
400000.00
600000.00
MaxLimit

改 怎么写 求高手解答



[解决办法]

SQL code
select replace(replace(replace(replace(replace(DivisionLineValue, 'begin', ''), 'begin0', ''), 'begin00', ''), 'begin000', ''), 'begin0000', '')from (  select 'begin' || case char(DivisionLineValue)    when '0999999999.00 '       then StandByTwo       else char(DivisionLineValue)      end as DivisionLineValue  from RIDivisionLineDef ) as A 

读书人网 >IBM DB2

热点推荐