首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > IBM DB2 >

db2 数据类型转化有关问题

2012-02-21 
db2数据类型转化问题select casechar(DivisionLineValue)when0999999999.00 thenStandByTwoelsechar(Div

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 

热点排行