Oracle的序列中的order和noorder选项的区别,都有什么用???
发布网友
发布时间:2022-09-27 02:36
我来回答
共1个回答
热心网友
时间:2023-10-06 05:18
--取两个日期间的工作天数
SELECT COUNT(*) INTO vn
FROM (SELECT vod + ROWNUM - 1 RN
FROM DUAL
CONNECT BY ROWNUM <= vnd - vod)
WHERE TO_CHAR(RN, 'D') BETWEEN 2 AND 6;
--返回数字
RETURN vn;
--异常判断并返回-1
EXCEPTION
WHEN OTHERS THEN
RETURN -1;
END fun_get_workdays;
然后select id,fun_get_workdays(begin_date date, end_date date) from table
热心网友
时间:2023-10-06 05:18
--取两个日期间的工作天数
SELECT COUNT(*) INTO vn
FROM (SELECT vod + ROWNUM - 1 RN
FROM DUAL
CONNECT BY ROWNUM <= vnd - vod)
WHERE TO_CHAR(RN, 'D') BETWEEN 2 AND 6;
--返回数字
RETURN vn;
--异常判断并返回-1
EXCEPTION
WHEN OTHERS THEN
RETURN -1;
END fun_get_workdays;
然后select id,fun_get_workdays(begin_date date, end_date date) from table