Subject Re: [firebird-support] calling a procedure within a procedure
Author Helen Borrie
Brendan,

You seem to have a few logic issues here but, to answer *this* question
---

At 07:42 AM 7/03/2005 +0000, you wrote:


>Hello
>
>When I attempt to compile the below procedure I get a function unknown
>for the GET_WORKING_DAYS.
>
>This is compile on my DB and I can execute it from the command line.
>
>Do I need to declare this procedure at the start and if so how do I do
>that?
A stored procedure isn't a function and it won't work if you try to call it
like one.

So - you want to declare a variable into which to call the result of the SP,

e.g.
CREATE PROCEDURE...
...
as
declare variable working_days integer;
declare variable start_date date;
...
begin
....
start_date = TE.START_DATE;
execute procedure GET_WORKING_DAYS(:start_date,:DATE_TO)
returning_values(:working_days);
....

> AND CD.DIVISOR_RESULT = :working_days

....

Now, as I recall, you wrote this procedure as a selectable SP, i.e. you
included a SUSPEND statement. If you plan to invoke this from other SPs or
from triggers, you'll need to recreate it without the SUSPEND.

./hb