Re: Recursive Function
- From: "Juan Cachito Reyes Pacheco" <jreyes@xxxxxxxxxxxxxxxx>
- To: <oracle-l@xxxxxxxxxxxxx>
- Date: Thu, 6 May 2004 19:35:29 -0400
Hi Sridharan if you accept a suggestion, as I understand it is so
1. put the return at the end, not conditional, is better to have only one
return
2. I think you forgot the loop
CREATE OR REPLACE FUNCTION Recursive_function (p_parent IN NUMBER)
RETURN NUMBER
IS
v_parent NUMBER (5);
v_val NUMBER(5);
BEGIN
while true loop
SELECT PARENT_ID=20
INTO v_parent
FROM DSCR_CONTENT
WHERE DSCR_CONTENT_ID = p_parent;
IF v_parent IS NULL THEN
exit;
ELSE
p_parent :=3D Recursive_function (p_parent);
END IF;
end loop;
RETURN (p_parent);
END Recursive_function;
Juan Carlos Reyes Pacheco
OCP
Database 9.2 Standard Edition
----------------------------------------------------------------
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 http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
- References:
- Recursive Function
- From: SRIDHARAN, SAN (SBCSI)
Other related posts:
- » Recursive Function
- » Re: Recursive Function
- » Re: Recursive Function
- » RE: Recursive Function
- » Re: Recursive Function
- » Re: Recursive Function
- » Re: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- » RE: Recursive Function
- Recursive Function
- From: SRIDHARAN, SAN (SBCSI)