第1个回答 2019-03-20
select t.data from (
select t.data,func_getworkdays((某日期),t.data) days from (
select sysdate+rownum data from dual connect by rownum<=50
) t) t where days = 10
select t.data from (
select t.data,func_getworkdays(sysdate,t.data) days from (
select sysdate+rownum data from dual connect by rownum<=50
) t) t where days = 10create or replace function func_getworkDays(
startdate date,
enddate date)
return number
is
v_number number(18,0);--记录日期数
begin
select to_date(to_char(enddate,'yyyy-mm-dd'),'yyyy-mm-dd') - to_date(to_char(startdate,'yyyy-mm-dd'),'yyyy-mm-dd') - count(1) into v_number from sm_sys_holiday
where holiday_date between startdate and enddate ;
return v_number;
exception
when NO_DATA_FOUND then
v_number := 0;
return v_number ;
end func_getworkDays;
第2个回答 2018-12-26
SQL> alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
Session altered.
SQL> select trunc(calendar_date+10) from tq where id=8;
2017-04-20 00:00:00
2018-06-25 00:00:00
2018-12-23 00:00:00
19 rows selected.
SQL> select calendar_date from t1 where id=8;
2017-04-10 11:28:13
2018-06-15 15:57:58
2018-12-13 05:05:10
SQL> select calendar_date+10 from t1 where id=8;
2017-04-20 11:28:13
2018-06-25 15:57:58
2018-12-23 05:05:10