rdecimal.sql 255 B

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