Here is a recursive function that I wrote to find the grand-grand parent value for the input I pass in the function. However, when I call this function, it returns null all the time. What is strange is the DBMS_OUTPUT prints the value that I need. Any comments/suggestions/pointers are most welcome. CREATE OR REPLACE FUNCTION Recursive_function (p_parent IN NUMBER) RETURN NUMBER IS v_parent NUMBER (5); v_val NUMBER(5); BEGIN SELECT PARENT_ID=20 INTO v_parent FROM DSCR_CONTENT WHERE DSCR_CONTENT_ID =3D p_parent; IF v_parent IS NULL THEN DBMS_OUTPUT.PUT_LINE (To_char(P_parent)); RETURN (p_parent); ELSE v_val :=3D Recursive_function (v_parent); END IF; END Recursive_function; ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx put 'unsubscribe' in the subject line. -- Archives are at //www.freelists.org/archives/oracle-l/ FAQ is at //www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------