--取一个期间的最后一天
FUNCTION GET_PERIOD_LAST_DATE(P_PERIOD_NAME IN VARCHAR2) RETURN DATE IS
L_GL_DATE DATE;
BEGIN
SELECT GP.END_DATE
INTO L_GL_DATE
FROM GL_PERIODS GP
WHERE GP.PERIOD_SET_NAME = 'ZJG_CALENDAR'
AND GP.PERIOD_NAME = P_PERIOD_NAME
AND GP.ADJUSTMENT_PERIOD_FLAG = 'N';
RETURN L_GL_DATE;
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END;
-- 获取期间的最后一天
FUNCTION GET_PERIOD_LAST_DAY(P_PERIOD_NAME IN VARCHAR2) RETURN DATE IS
L_LAST_DATE DATE;
BEGIN
SELECT TRUNC(LAST_DAY(TO_DATE(P_PERIOD_NAME,
'YYYY-MM')))
INTO L_LAST_DATE
FROM DUAL;
RETURN L_LAST_DATE;
EXCEPTION
WHEN OTHERS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END GET_PERIOD_LAST_DAY;