料青山看我应如是
--工作日期参数表(说明 iswork :0-不是工作日 1-是工作日 。设置说明:1)如果正常工作日(1-5)中有非工作日,需要在此维护设iswork设为0,2)如果周六周日为工作日,则需要在此维护iswork=1。create table dict_workdate(workdate varchar2(10),iswork number(2),primary key workdate);--判断是否为交易日函数CREATE OR REPLACE FUNCTION isworkdate(in_date date) Return numberisresult varchar2(256);l_week number(1);l_workdate varchar2(10);l_iswork number(1);beginselect to_char(in_date,'D') into l_week from dual;l_workdate := to_char(in_date,'yyyy-mm-dd') ;if l_week in (1,7) thenselect nvl(max(iswork),0) into l_isworkfrom dict_workdate where workdate=l_workdate ;elseselect nvl(max(iswork),1) into l_isworkfrom dict_workdate where workdate=l_workdate ;end if;return l_iswork;EXCEPTIONWHEN OTHERS THENreturn null;END;