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

时间:2019-10-23 12:41:00

标签: sql oracle

我要从字符串

中获取相应月份和年份的最后日期
'opimus_rise_issue_command_201912.txt'

预期输出-

20191231

2 个答案:

答案 0 :(得分:1)

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

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>

答案 1 :(得分:0)

选中此

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
      <form id="form1">
        <input type="text" name="username" placeholder="Username" id="username" required>
        <button type="submit" id="submitbutton">submit</button>
      </form>
    </div>
    <div id="container">
      <div id='textdisplay'>
        <span class="anim">BlueBox</span>
      </div>
    </div>

31/12/2019