473,624 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Returning multiple rows from a stored procedure..

-
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
3 7605
- 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
-
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("CA LL get_countries() ");
echo $result; // produces empty result, neither true nor false.
Jul 23 '05 #3
-
- wrote:
$result = mysql_query("CA LL 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10763
by: Rowland Hills | last post by:
I have a table which is returning inconsistent results when I query it! In query analyzer: If I do "SELECT * FROM TABLE_NAME" I get no rows returned. If I do "SELECT COL1, COL2 FROM TABLE_NAME" I get 4 rows returned. In Enterprise manager:
3
16328
by: JB | last post by:
To anyone that is able to help.... What I am trying to do is this. I have two tables (Orders, and OrderDetails), and my question is on the order details. I would like to set up a stored procedure that essentially inserts in the orders table the mail order, and then insert multiple orderdetails within the same transaction. I also need to do this via SQL 2000. Right now i have "x" amount of variables for all columns in my orders tables,...
5
8670
by: Stanley Sinclair | last post by:
I have a need to return multiple result sets from a stored procedure. Want that SP to call others to get the data. Win2003, db2 8.1.5. Can't figure out how to handle open cursors, and return >1 result sets. Thought about global temp tables.
1
3274
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly simple one, in theory anyway. The gist is to create a page where the user enters an IDNumber,...
5
16551
by: Wael | last post by:
Hi, I have the following stored procedure that does some processing and puts the result in a temporary table. I tried several things that procedure to display output that I can access with ADO.Net, but it doesn't work. It doesn't even display the result in the query analyzer unless I add SELECT @ReturnFullName Any help? The stored procedure:
2
3013
by: jzogg7272 | last post by:
In my code I am executing a stored procedure to do a single row insert. I check the return value of the execution and I am getting -1, whereas a few weeks ago it was returning 0. Actually, I found that all of my insert stored procs are returning -1. The stored proc/insert statement is still executing successfully but the return code is different. If I execute the procedure from SQL Query Analyzer with the same params, it shows a return...
3
4993
by: bogdan | last post by:
Hi, I have a stored procedure that returns a single value. Example: SELECT @RowCount = COUNT(*) FROM t WHERE RETURN @RowCount I created a data set, table adapter, and adapter's method configured for the stored proc and as returning a single value. The wizard created an adapter method that calls SqlCommand.ExecuteScalar(). The problem is that
6
25127
by: Constantine AI | last post by:
Can anyone help? Ive created the below stored procedure to allow an input parameter of post code to be entered to display properties which have this post code. The procedure creates fine but because i have two properties with the post code 'S1 4SG', the execution of the procedure fails, it gives the error: ERROR at line 1: ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at "CBRAID.PROC_PROPSEARCH", line 19...
3
4372
by: codefragment | last post by:
Hi I have a chunky bit of sql that I will want to call from a number of places. It will return a few thousand rows. Whats the best way of structuring this? 1) I initially thought of using nested stored procedures and returning the result in a temporary table. However the scope of the temporary table seems to be limited to the stored procedure its created in so unless I create the temporary table in every stored
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.