MySQL Forums
Forum List  »  Stored Procedures

returning a ResultSet of ResultSets
Posted by: Daniel Fernandez
Date: April 15, 2009 10:26AM

Hi all,
I have almost 0 experience with MySQL store procedures. I am trying to return a resultset of resultsets or values. In Postgres it is quite easy but here i am stuck with it.
Let me expose my case...
Let's say i have 2 tables, like:
Companies(name,description)
Workers(company_name,worker_name)

now i want to return a resultset containing:
position:0: companies.name
position:1: companies.description
position:2: workers.worker_name (of that company)

I am trying to do something like:


DELIMITER $$
DROP PROCEDURE IF EXISTS archiveconfiguration.get_archives
$$

CREATE PROCEDURE archiveconfiguration.get_archives()
BEGIN

SELECT companies.name, companies.description, (select workers.worker_name from workers,companies where workers.company_name=companies.name)FROM company;

END;
$$

DELIMITER ;


Then in the java side i get a resultset and i can know in the 2nd position i have another resultset.
This sintax for the select works for postgres, but here i cannot find a solution...

Any ideas?
Thanks in advance,
Dani.

Options: ReplyQuote


Subject
Views
Written By
Posted
returning a ResultSet of ResultSets
3169
April 15, 2009 10:26AM


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.