rdecimal.sql 234 B

123456789101112131415
  1. DELIMITER //
  2. drop function if exists rdecimal;
  3. CREATE FUNCTION rdecimal ( f float, p int )
  4. RETURNS decimal(20,4)
  5. BEGIN
  6. DECLARE ret DECIMAL(20,4);
  7. set ret = cast(round(f,p) as decimal(20,4));
  8. RETURN ret;
  9. END; //
  10. DELIMITER ;