> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/to_number.md).

# TO\_NUMBER

{% hint style="info" %}
`TO_NUMBER` is available from [MariaDB 12.2](/docs/release-notes/community-server/old-releases/12.2/mariadb-12.2-changes-and-improvements.md).
{% endhint %}

`TO_NUMBER` converts an expression to the [NUMERIC](/docs/server/reference/data-types/numeric-data-types/numeric.md) data type.

## Syntax

```bnf
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 implemented via [MDEV-36978](https://jira.mariadb.org/browse/MDEV-36978).

## Examples

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

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/to_number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
