In Oracle and MariaDB, the ROUND function rounds the number to the nearest value with the specified precision
Oracle:
-- Round to integer SELECT ROUND(123.4) FROM dual; /* 123 */ -- Round to 1 decimal digit (rounded to lower value as 4 <= 5) SELECT ROUND(123.34, 1) FROM dual; /* 123.30 */ -- Round to 1 decimal digit (rounded to upper value as 6 > 5) SELECT ROUND(123.36, 1) FROM dual; /* 123.40 */
MariaDB:
-- Round to integer SELECT ROUND(123.4); /* 123 */ -- Round to 1 decimal digit (rounded to lower value as 4 <= 5) SELECT ROUND(123.34, 1); /* 123.30 */ -- Round to 1 decimal digit (rounded to upper value as 6 > 5) SELECT ROUND(123.36, 1); /* 123.40 */
If the precision is negative, the ROUND function rounds or truncates the integer part:
Oracle:
-- Round to tens (rounded to lower value as 3 <= 5) SELECT ROUND(123, -1) FROM dual; /* 120 */ -- Round to hundreds (rounded to upper value as 56 > 50) SELECT ROUND(156, -2) FROM dual; /* 200 */
MariaDB:
-- Round to tens (rounded to lower value as 3 <= 5) SELECT ROUND(123, -1); /* 120 */ -- Round to hundreds (rounded to upper value as 56 > 50) SELECT ROUND(156, -2); /* 200 */
For more information, see Oracle to MariaDB Migration.