I got the error message while running Oracle PL/SQL recursive function
function returned without value
Anyone knows what might be the issue?
Here's my function
FUNCTION cgic (cnt IN NUMBER)
RETURN VARCHAR2
IS
n_inv_code VARCHAR2 (20);
t_ic_chk NUMBER;
BEGIN
SELECT DBMS_RANDOM.STRING ('X', 10)
INTO n_inv_code
FROM DUAL;
select count(*) into t_ic_chk from inv_code where inv_code = n_inv_code and rownum = 1;
IF t_ic_chk = 1
THEN
n_inv_code := cgic(cnt);
ELSE
IF t_ic_chk = 0
THEN
RETURN n_inv_code;
END IF;
END IF;
END cgic;
t_ic_chk <> 1?returnstatement. It's simply a bug in the function implementation. Unfortunately the compiler won't catch the bug for your (at least in 11gR2) but the exception takes place in runtime only.