regexp_like(source_char,pattern,match_param) --不用正则的写法 selectsum(money) from sometable where to_char(time,'yyyymmddhh24')='2019091606'; selectsum(money) from sometable where to_char(time,'yyyymmddhh24')='2019091607'; selectsum(money) from sometable where to_char(time,'yyyymmddhh24')='2019091608'; --....等等等等。然后把结果加起来
--用正则来匹配 selectsum(money) from sometable whereregexp_like(to_char(time,'yyyymmddhh24'),'201909160[6-9] | 1[0-4]');
'n' allows the period (.), which is the match-any-character character, to match the newline character. If you omit this parameter, then the period does not match the newline character.
'm' treats the source string as multiple lines. Oracle interprets the caret ( ^) and dollar sign ($) as the startandend, respectively, ofany line anywhere in the sourcestring, rather thanonlyat the startorendof the entire source string. If you omit this parameter, thenOracle treats the sourcestringas a single line.