duchaoqun

类型转换

SELECT numeric \'10\' / numeric \'3\' AS col_1;                    -- PG语法
SELECT \'10\'::numeric/\'3\'::numeric AS col_1;                    -- PG语法
SELECT CURRENT_DATE::varchar(20);                              -- PG语法

select cast(\'10\' as numeric) / cast (\'3\' as numeric) as col_1; -- 标准的SQL语法

-- cast 函数
select substring(cast(\'12345\' as text), 3, 1);

分类:

技术点:

相关文章: