Subject | Re: Ordering in the LIST function |
---|---|
Author | martins.goncalo |
Post date | 2008-06-03T09:07:32Z |
Hello.
The query I use is a little more complex but I've been able to
reproduce my problem with the initial example:
1: This works (your sugestion)
select
country.name_country,
list(citys.name_city)
from country,( select id_country,name_city from citys order by
population ) citys
where citys.id_country = country.id_country
group by country.name_country
2: This doesn't work (doesn't order the citys by population)
select
country.name_country,
list(citys.name_city)
from country,SP_CITYS citys
where citys.id_country = country.id_country
group by country.name_country
Where SP_CITYS is this procedure:
SET TERM ^ ;
CREATE PROCEDURE SP_CITYS
returns (
id_country integer,
name_city varchar(100))
as
BEGIN
FOR
select id_country,name_city from citys order by population
INTO :ID_COUNTRY,
:NAME_CITY
DO
BEGIN
SUSPEND;
END
END^
SET TERM ; ^
Any ideia why this doens't work in a procedure? Or any other tip to
solve the problem?
Thanks
--- In firebird-support@yahoogroups.com, Dmitry Yemanov <dimitr@...>
wrote:
The query I use is a little more complex but I've been able to
reproduce my problem with the initial example:
1: This works (your sugestion)
select
country.name_country,
list(citys.name_city)
from country,( select id_country,name_city from citys order by
population ) citys
where citys.id_country = country.id_country
group by country.name_country
2: This doesn't work (doesn't order the citys by population)
select
country.name_country,
list(citys.name_city)
from country,SP_CITYS citys
where citys.id_country = country.id_country
group by country.name_country
Where SP_CITYS is this procedure:
SET TERM ^ ;
CREATE PROCEDURE SP_CITYS
returns (
id_country integer,
name_city varchar(100))
as
BEGIN
FOR
select id_country,name_city from citys order by population
INTO :ID_COUNTRY,
:NAME_CITY
DO
BEGIN
SUSPEND;
END
END^
SET TERM ; ^
Any ideia why this doens't work in a procedure? Or any other tip to
solve the problem?
Thanks
--- In firebird-support@yahoogroups.com, Dmitry Yemanov <dimitr@...>
wrote:
>
> martins.goncalo wrote:
> >
> > Yes, that works. But if I put the
> > ( select name from city order by population ) city
> >
> > in a procedure (ex: sp_get_citys_by_population)
> > the list doesn't work. The order is incorrect. Is this a bug of
> > firebird or list just doesn't work with procedures?
>
> It would be helpful to show us the exact query and procedure you use.
>
>
> Dmitry
>