Error using the COUNT function in a stored procedure

<[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
Hi,

I am not sure if I should post this problem here since I am using the
beta.  If I shouldn't have please disregard my post.

Version: MySQL Version 5.0
OS:      Windows XP

I was writing a stored procedure to test out the procedure/function
implementation in MySQL and ran into a problem using the COUNT function
inside of a procedure.  Below is the sample stored procedure that will
reproduce the problem.  I believe this example was found in the online
documentation somewhere.

Procedure that counts rows and returns the value:

CREATE PROCEDURE  eco_count(out param1 INT)
BEGIN
  select count(*) into param1 from eco_class_t;
END

When I call the above procedure the first time it works perfect but
unfortunately each subsequent time it reurns the following error:

mysql> call eco_count(@a);                    <----- Works Fine
Query OK, 0 rows affected (0.00 sec)

mysql> select @a;  <---- here is the output
+------+
| @a   |
+------+
| 4    |
+------+
1 row in set (0.00 sec)

mysql> call eco_count(@a);   <------ same exact call returns an error
ERROR 1172 (42000): Result consisted of more than one row
mysql>

I have tried using COUNT(table.row) and had the same problem.

thanks,

John
[email protected]




-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.