SQL - 型変換

型変換

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);

おすすめ

転載: www.cnblogs.com/duchaoqun/p/11962007.html