MySQL Forums
Forum List  »  Stored Procedures

Multiple tables
Posted by: itmpmail
Date: November 17, 2005 03:41PM

Is it possible, in a stored procedure, to return multiple tables? For instance if you want to return the person matching a certain id in table one then return all thier appointments in table two. The idea is to fill a dataset and create a relationship between tables. An example of how you might do this is below, this causes a syntax break because, I suppose, you cannot have more then one line followed by a semi-colon. Do you instead have to hit the DB twice to get this data. I do know about the ability to join the tables but what I want is a multiple table result set. Thanks for your help.

delimiter //
create procedure sp_GetPersonAndAppointments (IN perId INT)
BEGIN
SELECT * FROM person WHERE personID = perId;
SELECT * FROM appointments WHERE personID = perId;
END//

Options: ReplyQuote


Subject
Views
Written By
Posted
Multiple tables
5882
November 17, 2005 03:41PM
2278
November 17, 2005 05:05PM
2099
November 18, 2005 08:48AM
1888
November 17, 2005 06:46PM


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.