Error using the COUNT function in a stored procedure

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( [at] a); <----- Works Fine
Query OK, 0 rows affected (0.00 sec)

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

mysql> call eco_count( [at] 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 [at] espressoshot.com




--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
winderjj [ Fr, 30 April 2004 17:44 ] [ ID #83161 ]

Re: Error using the COUNT function in a stored procedure

At 12:44 30/4/2004, winderjj [at] 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 <miguel [at] mysql.com>
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 [at] m.gmane.org
miguel solorzano [ Fr, 30 April 2004 19:06 ] [ ID #83162 ]

Re: Error using the COUNT function in a stored procedure

Hi!

On Apr 30, winderjj [at] 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 <serg [at] mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ 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 [at] m.gmane.org
Sergei Golubchik [ Fr, 30 April 2004 19:12 ] [ ID #83163 ]
Datenbanken » gmane.comp.db.mysql.bugs » Error using the COUNT function in a stored procedure

Vorheriges Thema: error in comparing date with datetime
Nächstes Thema: delete from table limit @var; is not working