您的当前位置:首页 > 资讯 > postgresql
pgsql转int类型
2021-07-18 13:24:39 来源:admin 点击:980
如果超出上限::INT转换失败
用 cast(substring(b."adCode"::TEXT,1,4) as bigint)
select CASE WHEN b."adCode"::TEXT similar to '%00' THEN cast(substring(b."adCode"::TEXT,1,4) as bigint) ELSE cast(b."adCode" as bigint) END FROM
(select a."areaGmCode",a."objCode",a."objType",CASE WHEN a."adCode"::TEXT similar to '%000' THEN substring(a."adCode"::TEXT,1,6) ELSE a."adCode"::TEXT END FROM
(select "areaGmCode","objCode","objType",CASE WHEN "adCode"::TEXT similar to '%000' THEN substring("adCode"::TEXT,1,9) ELSE "adCode"::TEXT END FROM user_river_relationship) as a) as b