我是靠谱客的博主 年轻音响,这篇文章主要介绍mysql截取后八位_截取字符串中前8个数字,现在分享给大家,希望可以做个参考。

先替换非数字的为空,再截取

with tmp_a as (

select '2018-10-15 12:30:59' update_time from dual union all --结果是 20181015

select '2017/10/16 12:30:59' update_time from dual union all --结果是 20171016

select '20151015 12:30:59'   update_time from dual union all --结果是 20151015

select null                  update_time from dual union all --结果是 空

select '201510'              update_time from dual union all --结果是 201510

select '20131015123059'      update_time from dual           --结果是 20131015

)

select substr(regexp_replace(update_time,'[^0-9]'),1,8) 截取前8个数字 from tmp_a

最后

以上就是年轻音响最近收集整理的关于mysql截取后八位_截取字符串中前8个数字的全部内容,更多相关mysql截取后八位_截取字符串中前8个数字内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(119)

评论列表共有 0 条评论

立即
投稿
返回
顶部