如何从此字符串中提取月份的最后一天日期'opimus_rise_issue_command_201912.txt'



>我想要字符串中相应月份和年份的最后日期

'opimus_rise_issue_command_201912.txt'

预期输出--

20191231

一些嵌套函数可能会有所帮助。

SQL> with test (col) as
2    (select 'opimus_rise_issue_command_201912.txt' from dual)
3  select to_char(last_day(to_date(regexp_substr(col, 'd+'), 'yyyymm')), 'yyyymmdd') result
4  from test
5  /
RESULT
--------------------------------------------------
20191231
SQL>

检查这个

select LAST_DAY(to_date(regexp_replace('opimus_rise_issue_command_201912.txt', '[^0-9]', '') ||'01','yyyymmdd')) from dual;

2019/12/31

最新更新