By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

How to call Stored Procedure from C program

P: 18
Hi friends,

I created a stored procedure in MySQL like

create procedure p()
select NOW();

I write a C program, from which i wish to call this stored procedure, i used both mysql_query() and mysql_real_query() functions, but unable to call this stored procedure. Can U please help me out in this......

"CALL p() failed: PROCEDURE sarma.p can't return a result set in the given context" is the error Im getting.

I am using MySQL 5.0.24a on Linux.

thanx
sarma
Dec 7 '06 #1
Share this Question
Share on Google+
3 Replies


ronverdonk
Expert 2.5K+
P: 4,258
This belongs in the C/C++ forum. I'll transfer it.

Ronald :cool:
Dec 8 '06 #2

P: 55
Hi friends,

I created a stored procedure in MySQL like

create procedure p()
select NOW();

I write a C program, from which i wish to call this stored procedure, i used both mysql_query() and mysql_real_query() functions, but unable to call this stored procedure. Can U please help me out in this......

"CALL p() failed: PROCEDURE sarma.p can't return a result set in the given context" is the error Im getting.

I am using MySQL 5.0.24a on Linux.

thanx
sarma
hi there,

in C++ you can call this using reference or pointers, but for some instances you can call them using cout, actually it is'nt clear enough on what you really want to call, is there a statement involved inside that code declaration?


regards,
Dec 8 '06 #3

P: 18
Hello folks, Thanx for paying attention to my post.

I wrote a stored procedure to execute query "Select * from Emp" and Emp table have Empno, Empname fields.

I called this stored procedure from C using mysql_query(handle, "call sp()");

But i m unable to get result set using mysql_use_result or mysql_store_result.

Im using MySQL 5.0.24a on Linux. This is FYI.


thanx
sarma
Dec 11 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.