SnowConvert AI - Redshift - Literals¶
描述 ¶
字面量或常量是固定的数据值,由字符序列或数字常量组成。(Redshift SQL 语言参考“字面量” (https://docs.aws.amazon.com/redshift/latest/dg/r_Literals.html))。
Amazon Redshift 支持多种类型的字面量,包括:
支持整数、小数和浮点数的数字字面量。
字符串字面量,也称为字符串、字符序列或字符常量。
日期时间和间隔字面量,与日期时间数据类型结合使用。
示例源模式¶
输入代码:¶
Redshift¶
Result¶
integer_literal |
negative_integer |
decimal_literal |
simple_float |
|---|---|---|---|
42 |
-123 |
3.14159 |
1 |
simple_string |
newline_character |
tab_character |
mixed_literal |
|---|---|---|---|
42 |
Line1 Line2 |
制表符 |
值为 42 |
输出代码:
Snowflake¶
Result¶
integer_literal |
negative_integer |
decimal_literal |
simple_float |
|---|---|---|---|
42 |
-123 |
3.14159 |
1 |
simple_string |
newline_character |
tab_character |
mixed_literal |
|---|---|---|---|
42 |
Line1 Line2 |
制表符 |
值为 42 |
Known Issues¶
Snowflake 目前不支持此功能,但在将来的迁移过程中将支持此功能。
日期、时间和时间戳字面量¶
描述 ¶
Amazon Redshift 支持的日期、时间和时间戳字面量。(Redshift SQL 语言参考“日期、时间、时间戳字面量” (https://docs.aws.amazon.com/redshift/latest/dg/r_Date_and_time_literals.html))。
示例源模式¶
输入代码:¶
Redshift¶
输出代码:
Snowflake¶
Known Issues¶
与 Snowflake 相比,某些 DATE、TIME 和 TIMESTAMP 格式在 Redshift 中可能产生不同的结果。
相关的 EWIs¶
SSC-EWI-RS0007:Snowflake 不支持日期字面量。
间隔字面量¶
描述 ¶
间隔字面量可用于日期时间计算,例如,向日期和时间戳中添加间隔、求和间隔以及从日期或时间戳中减去间隔。间隔字面量可用作表中间隔数据类型列的输入值。(Redshift SQL 语言参考“间隔字面量” (https://docs.aws.amazon.com/redshift/latest/dg/r_interval_data_types.html#r_interval_data_types-syntax-literal))。
警告
该语法在 Snowflake 中部分受支持。
语法 ¶
Snowflake 间隔 只能用于算术运算。不支持在任何其他场景中使用间隔。
The following formats are the only ones recognized and fully transformed by SnowConvert AI, allowing optional fields and most of the abbreviations without interval styles:
Snowflake 不支持带有算术符号的字面量。如果字面量包含小时表达式,则表达式可以部分转换。
示例源模式¶
支持的场景¶
输入代码:¶
Redshift¶
输出代码:¶
Snowflake¶
待处理的转换场景¶
输入代码:¶
Redshift¶
输出代码:¶
Snowflake¶
Known Issues¶
未发现任何问题。
相关的 EWIs¶
SSC-EWI-0107:当前场景不支持间隔字面量。
SSC-EWI-0073:待进行功能等效性审查。
NULLS¶
描述 ¶
如果某行中的某列缺失、未知或不适用,则该列为 null 值或据说包含 null。(Redshift SQL 语言参考“Null 字面量” (https://docs.aws.amazon.com/redshift/latest/dg/r_Nulls.html))。
Null 值可能出现在不受主键或 NOT NULL 约束限制的任何数据类型的字段中。null 值不等于零值或空字符串。
示例源模式¶
输入代码:¶
Redshift¶
Result¶
Select1 |
|---|
NULL |
1+NULL |
1*NULL |
|---|---|
NULL |
NULL |
输出代码:
Snowflake¶
Result¶
Select1 |
|---|
NULL |
1+NULL |
1*NULL |
|---|---|
NULL |
NULL |
Known Issues¶
未发现任何问题。
相关的 EWIs¶
没有已知问题。