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 delimiers: 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 yet include the following features: - The ON CONVERSION ERROR clause - The third parameter (nlsparam) - Internationalized components: G, D, C, L, U. These features will be implemented later in 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?