当前位置: 代码迷 >> DB2 >> db2 数据类型转化有关问题
  详细解决方案

db2 数据类型转化有关问题

热度:8906   发布时间:2013-02-26 00:00:00.0
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
  相关解决方案