時間相加的函數(如對一個時間加上13秒)
時間相加的函數(如對一個時間加上13秒)
create or replace function HRF_GET_TIME(V_DATE DATE,V_NUM NUMBER,V_TYPE VARCHAR2) return date is
Result DATE;
begin
IF V_TYPE='D' THEN
select V_DATE+numtodsinterval(V_NUM,'DAY') INTO Result from dual;
ELSIF V_TYPE='H' THEN
select V_DATE+numtodsinterval(V_NUM,'HOUR') INTO Result from dual;
ELSIF V_TYPE='M' THEN
select V_DATE+numtodsinterval(V_NUM,'minute') INTO Result from dual;
ELSIF V_TYPE='S' THEN
select V_DATE+numtodsinterval(V_NUM,'SECOND') INTO Result from dual;
END IF;
return(Result);
end HRF_GET_TIME;