代码如下: — 获取上旬开始时间 create or replace function fd_lastxunstart(rq in date) return string is refstr varchar2(50); v_rq date; begin –获取上一旬的日期 v_rq := trunc(rq); select case decode(trunc((to_char(v_rq, ‘dd’) – 1) / 10), 0, ‘上旬’, 1, ‘中旬’, ‘下旬’) when ‘上旬’ th