Subject | Unknown error during procedure execute... |
---|---|
Author | RRokytskyy@skillberry.com |
Post date | 2001-07-14T20:41:57Z |
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?
- how should I change the procedure to be able to execute procedure and
receive the result values, but not using the "select * from <procedure>"
statements?
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?
- how should I change the procedure to be able to execute procedure and
receive the result values, but not using the "select * from <procedure>"
statements?
Thanks in advance,
Roman Rokytskyy