i want last date of the corresponding month and year from the string
x
'opimus_rise_issue_command_201912.txt'
expected output–
20191231
Advertisement
Answer
A few nested functions might help.
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>