Error using the COUNT function in a stored procedure

Error using the COUNT function in a stored procedure

am 30.04.2004 17:44:46 von winderjj

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
winderjj@espressoshot.com




--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: Error using the COUNT function in a stored procedure

am 30.04.2004 19:06:01 von miguel solorzano

At 12:44 30/4/2004, winderjj@espressoshot.com wrote:
Hi,

Thank you for the bug report I filled the below bug
report:

http://bugs.mysql.com/bug.php?id=3D3615&thanks=3D4

Regards,

For technical support contracts, visit https://order.mysql.com/
Are you MySQL certified?, http://www.mysql.com/certification/

Miguel Angel Sol=F3rzano
S=E3o Paulo - Brazil



--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs@m.gmane.org

Re: Error using the COUNT function in a stored procedure

am 30.04.2004 19:12:58 von Sergei Golubchik

Hi!

On Apr 30, winderjj@espressoshot.com wrote:
> 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.

Actually you are using alpha, 5.0 is not beta yet :)
But let it not prevent you from reporting bugs - reporting a bug is the
only way to know for certain that it will be fixed.
And we are truly grateful for you efforts.

> 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.

It's entered into bugdb as bug#3615
http://bugs.mysql.com/bug.php?id=3615

Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org