CREATE OR REPLACE FUNCTION getgrade (pid IN NUMBER, effdate IN DATE) RETURN VARCHAR2 IS
m_grade VARCHAR2(10);
BEGIN
SELECT pg.NAME
INTO m_grade
FROM per_grades pg, per_all_assignments_f ppf
WHERE ppf.GRADE_ID = pg.GRADE_ID
AND ppf.person_id = pid
AND TRUNC(effdate) BETWEEN TRUNC(ppf.EFFECTIVE_START_
DATE) AND TRUNC(ppf.EFFECTIVE_END_DATE);
-- AND ppf.ROWID IN (SELECT MAX(ROWID) FROM per_all_assignments_f GROUP BY person_id);
RETURN m_grade;
EXCEPTION
WHEN others THEN
RETURN NULL;
END;
/
m_grade VARCHAR2(10);
BEGIN
SELECT pg.NAME
INTO m_grade
FROM per_grades pg, per_all_assignments_f ppf
WHERE ppf.GRADE_ID = pg.GRADE_ID
AND ppf.person_id = pid
AND TRUNC(effdate) BETWEEN TRUNC(ppf.EFFECTIVE_START_
-- AND ppf.ROWID IN (SELECT MAX(ROWID) FROM per_all_assignments_f GROUP BY person_id);
RETURN m_grade;
EXCEPTION
WHEN others THEN
RETURN NULL;
END;
/
No comments:
Post a Comment