A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/try_to_double below:

TRY_TO_DOUBLE | Snowflake Documentation

Reference Function and stored procedure reference Conversion TRY_TO_DOUBLE
Categories:

Conversion functions

TRY_TO_DOUBLE

A special version of TO_DOUBLE that performs the same operation (that is, converts an input expression to a double-precision floating-point number), but with error-handling support (that is, if the conversion can’t be performed, it returns a NULL value instead of raising an error).

For more information, see Error-handling conversion functions.

Syntax
TRY_TO_DOUBLE( <string_expr> [, '<format>' ] )

Copy

Arguments
expr

An expression of a character type.

format

If the expression evaluates to a string, then the function accepts an optional format model. Format models are described at SQL format models. The format model specifies the format of the input string, not the format of the output value.

Usage notes Returns

This function returns a value of FLOAT data type.

If there is a conversion error, the function returns NULL.

Examples

This example uses the TRY_TO_DOUBLE function:

SELECT TRY_TO_DOUBLE('3.1415926'), TRY_TO_DOUBLE('Invalid');

Copy

+----------------------------+--------------------------+
| TRY_TO_DOUBLE('3.1415926') | TRY_TO_DOUBLE('INVALID') |
|----------------------------+--------------------------|
|                  3.1415926 |                     NULL |
+----------------------------+--------------------------+

For additional examples, see TO_DOUBLE.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4