wrong information retreived
gandolf989 wrote
Quote:
CREATE OR REPLACE FUNCTION departmentExists
( p_department mytable.department%TYPE)
RETURN BOOLEAN
CURSOR cur_explicit IS
SELECT department
FROM mytable
WHERE department = 'Sales';
v_department mytable.department%TYPE;
BEGIN
OPEN cur_explicit;
FETCH cur_explicit INTO v_department;
CLOSE cur_explicit;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN
CLOSE cur_explicit;
RETURN FALSE;
END departmentExists;
/
This has potential retrieving incorrect informattion IF MORE THAN 1 RECORD satisfy specified condition.