当前位置: 代码迷 >> DB2 >> 此段 函数 求高手帮忙分析下解决思路
  详细解决方案

此段 函数 求高手帮忙分析下解决思路

热度:3984   发布时间:2013-02-26 00:00:00.0
此段 函数 求高手帮忙分析下
SET SCHEMA DB2INST1;

SET CURRENT PATH = "SYSIBM","SYSFUN","SYSPROC","SYSIBMADM","DB2INST1";

CREATE FUNCTION DB2INST1.VARCHAR(CFLOAT DOUBLE) 
  RETURNS CHARACTER(30)
  SPECIFIC DB2INST1.SQL091023140234200
  LANGUAGE SQL
  NOT DETERMINISTIC
  READS SQL DATA
  STATIC DISPATCH
  CALLED ON NULL INPUT
  EXTERNAL ACTION
  INHERIT SPECIAL REGISTERS
  BEGIN ATOMIC declare tint bigint default 0; declare TPOINT int default 0; 
  declare RESULT varchar(20); 
declare aa decimal(12,2);
declare mpoint varchar
  (3) default '0'
; set tint=bigint(cfloat); 
set aa= round(cfloat-tint,2) ; 
  set TPOINT=int(aa*100); set mpoint= rtrim(char(TPOINT)); 
if TPOINT>=10 then 
  set RESULT=rtrim(char(tint))||'.'||mpoint;
else set RESULT=rtrim(char(tint))
  ||'.'||'0'||mpoint; 
end if;
return RESULT ; 
end;


------解决方案--------------------------------------------------------
想知道什么
  相关解决方案