FORMAT()

Overview

Returns a formatted number rounded to the specified number of decimal places.

USAGE

FORMAT(number, count)

Argument Name

Description

number

The number to format

count

The number of decimal places to include in the result

DETAILS

FORMAT() is a string function that returns a formatted number that is rounded to the specified number of decimal places.

The return value is formatted as #,###,###.##.

The return value does not include a decimal point in the result if the requested number of decimal places is 0.

A NULL is returned if either argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT FORMAT(1, 1), FORMAT(12345.2, 4);
+--------------+--------------------+
| FORMAT(1, 1) | FORMAT(12345.2, 4) |
+--------------+--------------------+
| 1.0          | 12,345.2000        |
+--------------+--------------------+
SELECT FORMAT(1, 0), FORMAT(1234567.2, 2);
+--------------+----------------------+
| FORMAT(1, 0) | FORMAT(1234567.2, 2) |
+--------------+----------------------+
| 1            | 1,234,567.20         |
+--------------+----------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES