On Mon, Nov 14, 2011 at 7:35 AM, Ana Claudia Smail
<anasmail(at)unnoba(dot)edu(dot)ar> wrote:
>
> DECLARE cursorg CURSOR FOR select $1,$2, count(*) from dms_cm group by 1,2;
>
Primero declara el cursor junto con las otras variables asi:
cursorg refcursor:
Luego en el cuerpo de la funcion:
OPEN cursorg FOR EXECUTE 'select ' || $1 || ', ' || $2 || ', count(*)
from dms_cm group by 1,2';
encuentras ejemplos aqui:
http://www.postgresql.org/docs/9.1/static/plpgsql-cursors.html#PLPGSQL-CURSOR-DECLARATIONS
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación