Re: SETOF

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Cc: fernando(at)icreativa(dot)com(dot)mx
Subject: Re: SETOF
Date: 2003-03-05 11:47:18
Message-ID: 3E65E3C5.1D964F0D@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> CREATE FUNCTION ejem1(varchar) RETURNS SETOF to varchar as'=20
> SELECT names from mi_tabla WHERE city =3D $1; '=20
> language ' SQL ';=20
>
> ejem1=20
> ------------
> Sergio=20
> Carlos=20
> Fernando=20
>
> When wanting to obtain several columns I do this...=20
>
> CREATE FUNCTION ejem2(varchar) RETURNS SETOF mi_tabla as'=20
> SELECT * from mi_tabla WHERE city =3D $1;'=20
> language ' SQL ';=20
>
> ejem2=20
> ---------------
> 137956448=20
> 137956448=20
> 137956448=20
>
> The number of registries that return is the correct, the question is,
becau=
> se=20
> it does not return the fields of the table, and that is what in its
place=
> =20
> this showing to me...=20
> Greetings and thank you very
much!=20=20=20=20=20=20=20=20=20=20=20=20=20=
> =20=20
>
You cannot obtain several columns from SQL functions.
See the list archives (search for SETOF) for details.
You have to use e.g. a plpgsql function instead.

Regards, Christoph

Responses

  • Re: SETOF at 2003-03-05 12:47:50 from Greg Stark

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Stark 2003-03-05 12:47:50 Re: SETOF
Previous Message luca.scaramella 2003-03-05 10:45:25 DELETE FROM A BLACK LIST