![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 1 of 1 total |
![]() |
Mon, Jun 28 2010 6:38 PM | Permanent Link |
Richard Harding Wise Nutrition Coaching | Tim,
I upgraded to v2.03b15 and tested out recursive functions with the following which works. CREATE FUNCTION "TriangleNumber" (IN "N" INTEGER) RETURNS INTEGER BEGIN DECLARE Result, I INTEGER; SET I = N; -- Required CASE I WHEN 0 THEN SET Result = 0; WHEN 1 THEN SET result = 1; ELSE SET Result = I + TriangleNumber(I - 1); END CASE; RETURN Result; END However, if the line SET I = N is removed and the subsequent references to I are replaced by the parameter N then EDBMgr terminates. Also, on the second execution of the function from EDBMgr, the input parameter dialog shows the parameter N as being a VARCHAR. Tried to calculate fibonacci numbers with the following function and it crashes with AV if the parameter is 5 or greater. CREATE FUNCTION "R" (IN "I" INTEGER) RETURNS INTEGER BEGIN DECLARE Result, N, M INTEGER; SET N = I-1; SET M = i-2; CASE N WHEN 0 THEN SET Result = 0; WHEN 1 THEN SET result = 1; ELSE SET Result = R(N) + R(M); END CASE; RETURN Result; END Richard Harding |
This web page was last updated on Monday, July 15, 2024 at 07:03 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |