MySQL Forums
Forum List  »  Stored Procedures

Calling stored procedure failure
Posted by: jerry kendall
Date: June 08, 2005 07:11AM

Hi all;

I am experiencing a strange response to a stored procedure.

I have created a stored procedure in MySQL 5.0.6 Beta.

The procedure is as follows:
===========================================
DELIMITER $$

DROP PROCEDURE IF EXISTS `ViewIntus`.`TableNameListCnt`$$

CREATE PROCEDURE `ViewIntus`.`TableNameListCnt` ()
SQL SECURITY INVOKER
COMMENT 'Count the number of TableNames'
BEGIN
SELECT COUNT(*)
FROM TableName;
END$$
===========================================

Yes, I know this does not require a stored procedure but, this is the simplest code to demonstrate the issue.

Most of my other stored procedures work as expected.

OK.... Simple enough.
Now,

with the following query tools:
- MySQL Control Center
- MySQL Query Browser
- MySQL UNIX command Line tool
I can execute:

USE database_name;
CALL TableNameListCnt();

and everything works as expected.


But, I have a 'C' program that calls this same procedure and it fails.

When I call execute 'mysql_query(SqlConnection, "SELECT COUNT(*) FROM TableName");' it works fine.


But, when I execute 'mysql_query(SqlConnection, "CALL TableNameListCnt()");',
I get the following error:

"SQL error (PROCEDURE database_name.TableNameListCntcan't return a result set in the given context) while executing (CALL TableNameListCnt())".

I have looked at many BUG reports, howtos, forums, etc but cant seem to get any insight into this.

can anyone help me?

Please.




--
Jerry Kendall, CISSP
jerry@pentego.com
Pentego technologies Ltd.
www.pentego.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Calling stored procedure failure
2390
June 08, 2005 07:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.