TO_NUMBER

TO_NUMBER is available from MariaDB 12.2.

TO_NUMBER converts an expression to the NUMERIC data type.

Syntax

TO_NUMBER(number_or_string_subject)
TO_NUMBER(string_subject,string_format)

Description

The function returns the DOUBLE data type for all signatures and input data types.

The format parser understands the following components:

  • Digits: 0, 9

  • Hex digits: X

  • Group separators: comma (,) and G

  • Decimal delimiters: period (.) and D

  • Approximate number signature: EEEE

  • Currency/numeric flags: $ and B

  • Currency signatures: C, L, U

  • Sign signatures: S, MI, PR

  • Special format signatures: V, TM, TM9, TME

  • Format flag: FM

The function was introduced for Oracle compatibility, but does not include the following features:

  • The ON CONVERSION ERROR clause

  • The third parameter (nlsparam)

  • Internationalized components: G, D, C, L, U

These features are planned to be be implemented via MDEV-36978.

Examples

SELECT TO_NUMBER('100.00');
+---------------------+
| TO_NUMBER('100.00') |
+---------------------+
|                 100 |
+---------------------+

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?