Subject | "Unknown error" during procedure execute... |
---|---|
Author | RRokytskyy@skillberry.com |
Post date | 2001-07-15T20:18:22Z |
Hello,
Maybe I'm in wrong list, so please point the right one. :)
I have strange behaviour of Firebird 0.9.4p1/Win2k and with IB
6.0.1/Win2k during procedure execute.
Procedure code:
SET TERM ^ ;
/* Stored procedures */
CREATE PROCEDURE FACTORIAL (NUMBER INTEGER)
RETURNS (RESULT INTEGER)
AS
BEGIN EXIT; END ^
ALTER PROCEDURE FACTORIAL (NUMBER INTEGER)
RETURNS (RESULT INTEGER)
AS
DECLARE VARIABLE temp INTEGER;
BEGIN
temp = number - 1;
IF (NOT temp IS NULL) THEN BEGIN
IF (temp > 0) THEN
EXECUTE PROCEDURE factorial(:temp) RETURNING_VALUES :temp;
ELSE
temp = 1;
result = number * temp;
END
SUSPEND;
END
^
SET TERM ; ^
Simple enough (at least I think so :))
Statement
SELECT * FROM factorial(5);
executed in ISQL produces error "Unknown error Statement: select *
from factorial(5)" but after pressing "OK" button produces the
result "120".
Statement
EXECUTE PROCEDURE factorial(5);
executes in ISQL without any problem and produces the result "<null>".
The questions are:
- what kind of behaviour should I expect from this simple procedure?
- are there any issues with the recursive procedure calls?
Thanks in advance,
Roman Rokytskyy
Maybe I'm in wrong list, so please point the right one. :)
I have strange behaviour of Firebird 0.9.4p1/Win2k and with IB
6.0.1/Win2k during procedure execute.
Procedure code:
SET TERM ^ ;
/* Stored procedures */
CREATE PROCEDURE FACTORIAL (NUMBER INTEGER)
RETURNS (RESULT INTEGER)
AS
BEGIN EXIT; END ^
ALTER PROCEDURE FACTORIAL (NUMBER INTEGER)
RETURNS (RESULT INTEGER)
AS
DECLARE VARIABLE temp INTEGER;
BEGIN
temp = number - 1;
IF (NOT temp IS NULL) THEN BEGIN
IF (temp > 0) THEN
EXECUTE PROCEDURE factorial(:temp) RETURNING_VALUES :temp;
ELSE
temp = 1;
result = number * temp;
END
SUSPEND;
END
^
SET TERM ; ^
Simple enough (at least I think so :))
Statement
SELECT * FROM factorial(5);
executed in ISQL produces error "Unknown error Statement: select *
from factorial(5)" but after pressing "OK" button produces the
result "120".
Statement
EXECUTE PROCEDURE factorial(5);
executes in ISQL without any problem and produces the result "<null>".
The questions are:
- what kind of behaviour should I expect from this simple procedure?
- are there any issues with the recursive procedure calls?
Thanks in advance,
Roman Rokytskyy