Subject Re: [firebird-support] recursive procedure
Author Dmitry Sibiryakov
On 18 Jul 2005 at 18:24, Mitchell Peek wrote:

>now the question.. I want a sp in which I will pass the ID. It
>returns a row for the ID passed in, and a row for every parent up the
>line until parent_ID is null..
>
>This returns only the row I passes in, whats wrong with it?

DNA, perhaps...

>CREATE PROCEDURE SP_CAT_PARENT (
> In_ID INTEGER)
>RETURNS (
> Out_ID INTEGER,
> DESCRIPTION VARCHAR(50),
> PARENT_ID INTEGER)
>AS
>BEGIN
WHILE (In_ID is not NULL) DO
BEGIN
SELECT C.ID, C.DESCRIPTION, C.PARENT_ID
FROM CATEGORY C
WHERE C.ID = :In_ID
into :Out_ID, :DESCRIPTION, :PARENT_ID;
SUSPEND;
In_ID = PARENT_ID;
END
>END
>
>
>I know its something simple, but try not to be too cruel will ya?

If I'd wanted to be cruel I would suggest you visit a programming
course.
--
SY, Dimitry Sibiryakov.