Subject | Re: [firebird-support] recursive procedure |
---|---|
Author | Dmitry Sibiryakov |
Post date | 2005-07-19T04:55:21Z |
On 18 Jul 2005 at 18:24, Mitchell Peek wrote:
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
course.
--
SY, Dimitry Sibiryakov.
>now the question.. I want a sp in which I will pass the ID. ItDNA, perhaps...
>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?
>CREATE PROCEDURE SP_CAT_PARENT (WHILE (In_ID is not NULL) DO
> In_ID INTEGER)
>RETURNS (
> Out_ID INTEGER,
> DESCRIPTION VARCHAR(50),
> PARENT_ID INTEGER)
>AS
>BEGIN
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
>ENDIf I'd wanted to be cruel I would suggest you visit a programming
>
>
>I know its something simple, but try not to be too cruel will ya?
course.
--
SY, Dimitry Sibiryakov.