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

Returning multiple rows from a stored procedure..

P: n/a
-
I have a country table with code and name columns and create a stored
procedure 'get_countries()' but have no idea what is the syntax to
return multiple rows.

I have searched the newsgroups and understand that the solution is to
use cursors. Searching for the mySQL solution is to no avail.

Do assist me with the syntaxt.
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
- wrote:
I have a country table with code and name columns and create a stored
procedure 'get_countries()' but have no idea what is the syntax to
return multiple rows.

I have searched the newsgroups and understand that the solution is to
use cursors. Searching for the mySQL solution is to no avail.


Did you read the first user comment at the following web page? A user
gives an example of returning a result set from a procedure.
http://dev.mysql.com/doc/mysql/en/st...rocedures.html

Sadly, the online documentation on MySQL's stored procedure language is
pretty lean at this time.

Regards,
Bill K.
Jul 23 '05 #2

P: n/a
-
Bill Karwin wrote:

Did you read the first user comment at the following web page? A user
gives an example of returning a result set from a procedure.
http://dev.mysql.com/doc/mysql/en/st...rocedures.html


Thanks... I tried it on the mysql command prompt and it works but my php
statement produces an error. Is it because I must use a different
method of returning the result - other databases tutorial mentioned
cursors? or is it the function of php itself?

$result = mysql_query("CALL get_countries()");
echo $result; // produces empty result, neither true nor false.
Jul 23 '05 #3

P: n/a
-
- wrote:
$result = mysql_query("CALL get_countries()");
echo $result; // produces empty result, neither true nor false.


That's ok. I solved it using mysqli extension library since stored
proecedure is a new feature in mysql.
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.