Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime
Formats expr like #,###,###.##, rounded to scale decimal places.
Formats expr like fmt.
Syntax
format_number(expr, scale)
format_number(expr, fmt)
Arguments
expr: An expression that evaluates to a numeric.scale: AnINTEGERexpression greater than or equal to 0.fmt: ASTRINGexpression specifying a format.
Returns
A STRING.
A negative scale produces a null.
Examples
> SELECT format_number(12332.123456, 4);
12,332.1235
> SELECT format_number(12332.123456, '#.###');
12332.123
> SELECT format_number(12332.123456, 'EUR ,###.-');
EUR 12,332.-