Hi All,
Please find the function below. Need to conitinue program execution after the no data found exception to try another query. Do suggest how to accomplish this.
FUNCTION find_number(
p_id VARCHAR2,
p_flag_id VARCHAR2)
RETURN VARCHAR2
IS
v_number VARCHAR2(20);
BEGIN
SELECT ru.id INTO v_number
FROM employees ru
WHERE ru.id = NVL(p_id, ru.id);
--to check for no data found and try another query logic before retuning the v_number
RETURN v_number;
/If not data returned then try another query
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN(‘The employee is not in the database');
WHEN OTHERS
THEN
RETURN(‘Error ');
END find_number;