Subject Re: Return variables of stored procedures from a select
Author Adam
--- In, "Andres Eguiguren"
<andres.eguiguren@...> wrote:
> I want to create a stored procedures that returns a matrix using
> column names resulting from a select.
> I have a database with two tables: countries and cities (with
> population of each one).
> I need a report that combines in the first column all countries and
> the next columns should be the cities. For each cell in the matrix
> must appear population of the city or null (0).
> Could anyone help me? Thanks in advance for your help

A stored procedure is of no help for this particular task. You must
have a fixed number of output parameters for a stored procedure to
work, and I assume you have an arbitrary number of cities per country,
which means that you will need to handle this at the client end.

And null is not necessarily 0, it means undefined or unknown. If a
count for a given city is unknown, that does not mean it has a
population of 0.