Error while compiling the function,
CREATE FUNCTION get_oic(c IN VARCHAR2)
RETURN VARCHAR2
IS
a VARCHAR2(8) := c;
RES BOOLEAN := FALSE;
b VARCHAR2(8) :='00000000';
CNT NUMBER :=0;
SUBCNT NUMBER :=0;
BEGIN
WHILE RES != TRUE
LOOP
select COUNT(a.d) into CNT from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a) and b.GRADE in ('A','B','C');
IF CNT = 1 THEN
RES := TRUE;
select a.d into b from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a) and b.GRADE in ('A','B','C');
ELSE
Select COUNT(a.d) into SUBCNT from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a);
IF SUBCNT = 1 THEN
RES := FALSE;
select a.d into a from reporting\_structure a join erp b on round(a.d) = round(b.e) and round(a.e)=round(a);
ELSE
RES := TRUE;
b := 'NOT FND' ;
END IF;
END IF;
END LOOP;
RETURN(b);
END;
/