数据仓库服务 GaussDB(DWS)-二进制字符串函数和操作符:substring(string [from int] [for int])

时间:2025-02-12 15:05:09

substring(string [from int] [for int])

描述:截取子串。

返回值类型:bytea

示例:

12345
SELECT substring(E'Th\\000omas'::bytea from 2 for 3) AS RESULT;   result  ---------- \x68006f(1 row)

截取时间,获取小时数:

12345
select substring('2022-07-18 24:38:15',12,2)AS RESULT; result----------- 24(1 row)
support.huaweicloud.com/sqlreference-dws/dws_06_0031.html
推荐文章