diff --git a/content/docs-lite/en/docs/BriefTutorial/functions.md b/content/docs-lite/en/docs/BriefTutorial/functions.md index 72f89e71e0986cd12effb90b6755599fbcb96a1b..1064c490a00026b693ebc36b559f44c9079a0f27 100644 --- a/content/docs-lite/en/docs/BriefTutorial/functions.md +++ b/content/docs-lite/en/docs/BriefTutorial/functions.md @@ -1099,10 +1099,21 @@ The common functions of openGauss are as follows: ``` -- to\_number\(text, text\) +- to\_number \( expr \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) Description: Converts the values of the string type into the numbers in the specified format. + expr can be any expression that evaluates to a character string of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT, + or BINARY_DOUBLE, or null. + 1. If expr is NUMBER, then the function returns expr. + 2. If expr evaluates to null, then the function returns null. + 3. Otherwise, the function converts expr to a NUMBER value. + + DEFAULT return_value ON CONVERSION ERROR is optional. Allows you to specify the value to be returned when a conversion error occurs. + Return_value can be an expression or a binding variable, and must be evaluated as a character string of type CHAR、VARCHAR2、NCHAR or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT or BINARY_DOUBLE, or null. + + fmt is optional. Format string. + Return type: numeric Example: diff --git a/content/docs-lite/en/docs/BriefTutorial/type-conversion-functions.md b/content/docs-lite/en/docs/BriefTutorial/type-conversion-functions.md index b0bfb3b276b7ac2dbe17159718046a5818cb599d..d9c06889983c2e5734ce19f810c3966cb204c454 100644 --- a/content/docs-lite/en/docs/BriefTutorial/type-conversion-functions.md +++ b/content/docs-lite/en/docs/BriefTutorial/type-conversion-functions.md @@ -380,10 +380,21 @@ (1 row) ``` -- to\_number \( expr \[, fmt\]\) +- to\_number \( expr \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) Description: Converts **expr** into a value of the NUMBER type according to the specified format. + expr can be any expression that evaluates to a character string of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT, + or BINARY_DOUBLE, or null. + 1. If expr is NUMBER, then the function returns expr. + 2. If expr evaluates to null, then the function returns null. + 3. Otherwise, the function converts expr to a NUMBER value. + + DEFAULT return_value ON CONVERSION ERROR is optional. Allows you to specify the value to be returned when a conversion error occurs. + Return_value can be an expression or a binding variable, and must be evaluated as a character string of type CHAR、VARCHAR2、NCHAR or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT or BINARY_DOUBLE, or null. + + fmt is optional. Format string. + For details about the type conversion formats, see [Table 1](#en-us_topic_0283137417_en-us_topic_0237121973_en-us_topic_0059778246_t3987a5bb00154b0f9e55863b4ababd3d). If a hexadecimal string is converted into a decimal number, the hexadecimal string can include a maximum of 16 bytes if it is to be converted into a sign-free number. diff --git a/content/docs-lite/en/docs/SQLReference/type-conversion-functions.md b/content/docs-lite/en/docs/SQLReference/type-conversion-functions.md index 32240d5911263bb599be370af0a0d49a250ad019..c8c9a965941386de991f7d67a3b1d7bc5b7a5fb0 100644 --- a/content/docs-lite/en/docs/SQLReference/type-conversion-functions.md +++ b/content/docs-lite/en/docs/SQLReference/type-conversion-functions.md @@ -397,10 +397,21 @@ (1 row) ``` -- to\_number \( expr \[, fmt\]\) +- to\_number \( expr \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) Description: Converts **expr** into a value of the NUMBER type according to the specified format. + expr can be any expression that evaluates to a character string of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT, + or BINARY_DOUBLE, or null. + 1. If expr is NUMBER, then the function returns expr. + 2. If expr evaluates to null, then the function returns null. + 3. Otherwise, the function converts expr to a NUMBER value. + + DEFAULT return_value ON CONVERSION ERROR is optional. Allows you to specify the value to be returned when a conversion error occurs. + Return_value can be an expression or a binding variable, and must be evaluated as a character string of type CHAR、VARCHAR2、NCHAR or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT or BINARY_DOUBLE, or null. + + fmt is optional. Format string. + For details about the type conversion formats, see [Table 1](#en-us_topic_0283137417_en-us_topic_0237121973_en-us_topic_0059778246_t3987a5bb00154b0f9e55863b4ababd3d). If a hexadecimal string is converted into a decimal number, the hexadecimal string can include a maximum of 16 bytes if it is to be converted into a sign-free number. diff --git "a/content/docs-lite/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" "b/content/docs-lite/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" index a23e9c22073e58a09c45c030133a536c26372410..ad2530d045af8695fef37baab71a83e586de28dc 100644 --- "a/content/docs-lite/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" +++ "b/content/docs-lite/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" @@ -1099,10 +1099,15 @@ openGauss常用的函数如下: ``` -- to\_number\(text, text\) +- to\_number \( text \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) 描述:将字符串类型的值转换为指定格式的数字。 + DEFAULT return_value ON CONVERSION ERROR 可选的。允许指定在转换发生错误时返回的值。 + return_value 可以是表达式或绑定变量,并且必须计算为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值或 null。 + + fmt 可选的。格式化字符串。 + 返回值类型:numeric 示例: diff --git "a/content/docs-lite/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" "b/content/docs-lite/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" index 80905157d08831131a1021500794d82ac5de9a59..96b578d4d292a2e85d546d9114662f7d507c8047 100644 --- "a/content/docs-lite/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" +++ "b/content/docs-lite/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" @@ -397,10 +397,16 @@ (1 row) ``` -- to\_number \( expr \[, fmt\]\) +- to\_number \( expr \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) 描述:将expr按指定格式转换为一个NUMBER类型的值。 + 1. expr 输入为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、 BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值,或 null。 + + 2. DEFAULT return_value ON CONVERSION ERROR 可选的。允许指定在转换发生错误时返回的值。 + * return_value 可以是表达式或绑定变量,并且必须计算为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值或 null。 + 3. fmt 可选的。格式化字符串。 + 类型转换格式请参考[表1](#zh-cn_topic_0283137417_zh-cn_topic_0237121973_zh-cn_topic_0059778246_t3987a5bb00154b0f9e55863b4ababd3d)。 转换十六进制字符串为十进制数字时,最多支持16个字节的十六进制字符串转换为无符号数。 diff --git a/content/en/docs/BriefTutorial/functions.md b/content/en/docs/BriefTutorial/functions.md index ced9f5622b47f9f2e526fba4d6a1a94b24a21b97..a3bcec81306d65ef00e38a6a2710e625bc0d0a8b 100644 --- a/content/en/docs/BriefTutorial/functions.md +++ b/content/en/docs/BriefTutorial/functions.md @@ -1099,10 +1099,15 @@ The common functions of openGauss are as follows: ``` -- to\_number\(text, text\) +- to\_number \( text \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) Description: Converts the values of the string type into the numbers in the specified format. + DEFAULT return_value ON CONVERSION ERROR is optional. Allows you to specify the value to be returned when a conversion error occurs. + Return_value can be an expression or a binding variable, and must be evaluated as a character string of type CHAR、VARCHAR2、NCHAR or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT or BINARY_DOUBLE, or null. + + fmt is optional. Format string. + Return type: numeric Example: diff --git "a/content/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" "b/content/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" index ebc297f8b49bf9bc66a3123d6fc5e7939a95285f..3e1fa87d6190edda21abeda78cbfdd2f6ac1d1f5 100644 --- "a/content/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" +++ "b/content/zh/docs/BriefTutorial/\345\207\275\346\225\260.md" @@ -1099,9 +1099,15 @@ openGauss常用的函数如下: ``` -- to\_number\(text, text\) +- to\_number \( text \[ DEFAULT return_value ON CONVERSION ERROR \] \[, text\]\) - 描述:将字符串类型的值转换为指定格式的数字。 + 描述:将expr按指定格式转换为一个NUMBER类型的值。 + + 1. expr 输入为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、 BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值,或 null。 + + 2. DEFAULT return_value ON CONVERSION ERROR 可选的。允许指定在转换发生错误时返回的值。 + * return_value 可以是表达式或绑定变量,并且必须计算为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值或 null。 + 3. fmt 可选的。格式化字符串。 返回值类型:numeric diff --git "a/content/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" "b/content/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" index 7d6572853f343e2f2c2cb29f8c02b5180418dede..63aaf311e3103521b7af26e8d912c8f1fd2835fb 100644 --- "a/content/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" +++ "b/content/zh/docs/SQLReference/\347\261\273\345\236\213\350\275\254\346\215\242\345\207\275\346\225\260.md" @@ -398,10 +398,16 @@ (1 row) ``` -- to\_number \( expr \[, fmt\]\) +- to\_number \( expr \[ DEFAULT return_value ON CONVERSION ERROR \] \[, fmt\]\) 描述:将expr按指定格式转换为一个NUMBER类型的值。 + 1. expr 输入为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、 BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值,或 null。 + + 2. DEFAULT return_value ON CONVERSION ERROR 可选的。允许指定在转换发生错误时返回的值。 + * return_value 可以是表达式或绑定变量,并且必须计算为 CHAR、VARCHAR2、NCHAR 或 NVARCHAR2 类型的字符字符串、NUMBER、BINARY_FLOAT 或 BINARY_DOUBLE 类型的数值或 null。 + 3. fmt 可选的。格式化字符串。 + 类型转换格式请参考[表1](#zh-cn_topic_0283137417_zh-cn_topic_0237121973_zh-cn_topic_0059778246_t3987a5bb00154b0f9e55863b4ababd3d)。 转换十六进制字符串为十进制数字时,最多支持16个字节的十六进制字符串转换为无符号数。