

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 數值資料的 Teradata 樣式格式化字元
<a name="r_Numeric-format-teradata"></a>

接下來，您可以了解 TEXT\_TO\_INT\_ALT 和 TEXT\_TO\_NUMERIC\_ALT 函數如何解釋輸入*運算式*字串中的字元。您還可以找到可在 *format* 詞語中指定的字元清單。此外，您還可以找到 Teradata 樣式格式化和 Amazon Redshift *格式*選項之間差異的說明。


| 格式  | 說明  | 
| --- | --- | 
| G  | 輸入 expression 字串中不支援做為群組分隔符號。您無法在 format 詞語中指定此字元。 | 
| D | 基數符號。您可以在 *format* 詞語中指定此字元。此字元相當於 .(句號)。<br />基數符號不能出現在包含下列任何字元的 *format* 詞語中：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_Numeric-format-teradata.html) | 
| / , : % | 插入字元 / (正斜線)、逗號 (,)、: (冒號) 和 % (百分比符號)。<br />您不能在 *format* 詞語中包含這些字元。<br />Amazon Redshift 會忽略輸入 *expression* 字串中的這些字元。 | 
| .  | 句點作為基底數字元，即小數點。<br />此字元不能出現在以包含下列任何字元的 *format* 詞語中：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_Numeric-format-teradata.html) | 
| B | 您不能在 *format* 詞語中包含空格字元 (B)。在輸入 *expression* 字串中，開頭和結尾空格被忽略，並且不允許數字之間的空格。 | 
| \+ - | 您不能在 *format* 詞語中包含加號 (\+) 或減號 (-)。但是，如果加號 (\+) 和減號 (-) 出現在輸入 *expression* 字串中，則會隱含地剖析為數值的一部分。 | 
| V  | 小數點位置指示器。<br />此字元不能出現在以包含下列任何字元的 *format* 詞語中：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_Numeric-format-teradata.html) | 
| Z  | 抑制零的十進位數字。Amazon Redshift 修剪開頭零。Z 字元不能跟在 9 字元後面。如果小數部分包含 9 字元，則 Z 字元必須位於基數字元的左側。 | 
| 9  | 小數位。 | 
| CHAR(n)  | 對於此格式，您可以指定下列選項：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_Numeric-format-teradata.html) | 
| -  | 連字號 (-) 字元。<br />您不能在 *format* 詞語中包含此字元。<br />Amazon Redshift 會忽略輸入 *expression* 字串中的這個字元。 | 
| S | 帶符號的分區十進位值。S 字元必須位於 *format* 詞語中最後一個十進位數字之後。輸入 *expression* 字串的最後一個字元和對應的數字轉換在 [用於有符號區十進位、Teradata 樣式數值資料格式的資料格式字元](#r_Numeric-format-teradata-signed-zone) 中列出。<br />S 字元不能出現在包含下列任何字元的 *format* 詞語中：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_Numeric-format-teradata.html) | 
| E | 指數表示法。輸入 *expression* 字串可以包含指數字元。您不能在 *format* 詞語中指定 E 作為指數字元。 | 
| FN9 | Amazon Redshift 不支援。 | 
| FNE | Amazon Redshift 不支援。 | 
| $、USD、美元  | 貨幣符號 ($)、ISO 貨幣符號 (USD)，以及貨幣名稱美元。<br />ISO 貨幣符號 USD 和貨幣名稱美元區分大小寫。Amazon Redshift 只支援美元貨幣。輸入 *expression* 字串可以包含美元貨幣符號與數值之間的空格，例如「$123E2」或「123E2 $」。 | 
| L | 貨幣符號。此貨幣符號字元只能在 *format* 詞語中出現一次。您無法指定重複的貨幣符號字元。 | 
| C  | ISO 貨幣符號。此貨幣符號字元只能在 *format* 詞語中出現一次。您無法指定重複的貨幣符號字元。 | 
| N | 貨幣完整名稱。此貨幣符號字元只能在 *format* 詞語中出現一次。您無法指定重複的貨幣符號字元。 | 
| O | 雙重貨幣符號。您無法在 *format* 詞語中指定此字元。 | 
| U | 雙 ISO 貨幣符號。您無法在 *format* 詞語中指定此字元。 | 
| A | 完整的雙重貨幣名稱。您無法在 *format* 詞語中指定此字元。 | 

## 用於有符號區十進位、Teradata 樣式數值資料格式的資料格式字元
<a name="r_Numeric-format-teradata-signed-zone"></a>

您可以在 TEXT\_TO\_INT\_ALT 和 TEXT\_TO\_NUMERIC\_ALT 函數的 *format* 詞語中使用以下字元來表示帶符號的分區十進位值。


| 輸入字串的最後一個字元  | 數值轉換 | 
| --- | --- | 
| { 或 0 | n … 0  | 
| A 或 1 | n … 1 | 
| B 或 2  | n … 2 | 
| C 或 3 | *n* … 3 | 
| D 或 4  | *n* … 4 | 
| E 或 5 | *n* … 5 | 
| F 或 6 | *n* … 6 | 
| G 或 7  | n … 7 | 
| H 或 8  | n … 8 | 
| I 或 9  | n … 9 | 
| }  | -n … 0  | 
| J  | -n … 1 | 
| K  | -n … 2  | 
| L  | -n … 3  | 
| M  | -n … 4 | 
| N  | -n … 5 | 
| O  | -n … 6 | 
| P  | -n … 7 | 
| Q  | -n … 8 | 
| R  | -*n* … 9 | 