sql 常用语法

  1. 分割字符串 oracle
    01:20:08 转换成秒
select to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,1)) hour,
       to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,2)) minute,
       to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,3)) second,
  
       to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,1))*3600+
       to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,2))*60+
       to_number(regexp_substr(t.TIME_SAVE,'[^:]+',1,3)) num
FROM table  t

你可能感兴趣的:(mysql,sql,数据库)