Re: function/procedure error!
- Date: Thu, 6 Mar 2008 09:58:57 -0600
- From: Paul DuBois <paul@xxxxxxxxx>
- Subject: Re: function/procedure error!
At 7:48 AM -0800 3/6/08, puntapari wrote:
Hi everybody!
I have a little problem with one function. What i want is to make a function
which returns me numbers from 0 to the number that receives the function.
That can't work. A function returns a single value.
Perhaps you can write a procedure that writes the values to a temporary
table, and then select the contents of the table after calling the
procedure?
Example: if the function receives the number 4, it will return 0,1,2,3 and
4.
numbers
0
1
2
3
4
The problem is that it makes me a error.
CREATE OR REPLACE FUNCTION `cantidad`(n integer) RETURNS INTEGER AS
DECLARE
i integer;
BEGIN
FOR i IN 0..n LOOP
RETURN NEXT i;
END LOOP;
RETURN;
END;
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx