Subject RE: [firebird-support] What is wrong with this Stored Procedure?
Author Alan McDonald
> Hi,
>
> Can anybody tell me what is wrong with this Stored Procedure?
>
> It is supposed to return a path of the hierarchical data in the database.
>
> ---------------------------------------------------
>
> SET TERM ^;
>
> CREATE PROCEDURE GET_ITEM_PATH(A_ITEM VARCHAR(39))
> RETURNS (ITEM_PATH VARCHAR(4000))
> AS
> DECLARE A_ITEM_PARENT VARCHAR(29);
> BEGIN
> IF (NOT (A_ITEM='ROOT')) THEN
> BEGIN
> SELECT ITEM_PARENT
> FROM ITEMS
> WHERE ITEM=:A_ITEM
> INTO :A_ITEM_PARENT;
>
> SUBNET_PATH_RES = GET_ITEM_PATH(A_ITEM_PARENT)||'/'||ITEM_PATH;
> END
> END
>
> ----------------------------------------------------
>
> When I try to add the porocedure I get the error "Function unknown
> 'GET_ITEM_PATH'. Are recursive procedure calls not allowed in Firebird
> or am I doing something wrong?
>
> Cheers,
> Paul

you need to select the return variable of the procedure
and what is SUBNET_PATH_RES? it's not declared anywhere
and how do you returnt eh value found? there's no SUSPEND statement?
Alan