【发布时间】:2019-10-23 12:41:00
【问题描述】:
我想要字符串中相应月份和年份的最后日期
'opimus_rise_issue_command_201912.txt'
预期输出--
20191231
【问题讨论】:
我想要字符串中相应月份和年份的最后日期
'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 日
【讨论】: