Oracle:SELECT ROUND(AVG( nvl(收入,0) ),2) sal FROM salary
写个函数 自己调用处理就行了CREATE FUNCTION `NewProc`(format_vale VARCHAR(100)) RETURNS varchar(100)BEGINDECLARE dec_number VARCHAR(4000) DECLARE dec_number_vale VARCHAR(4000) SET dec_number = '' SET dec_number_vale = CAST(format_vale AS CHAR) WHILE dec_number_vale IS NOT NULL DO -- 剪切字符串SET dec_number = right(dec_number_vale,1) IF dec_number = '0' || dec_number= '.' THEN SET dec_number_vale = LEFT(dec_number_vale ,LENGTH(dec_number_vale)-1) ELSERETURN dec_number_vale END IF END WHILEEND欢迎分享,转载请注明来源:内存溢出
评论列表(0条)