From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | augustin_hm(at)yahoo(dot)es |
Cc: | Postgresql <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: a column definition list is required for functions returning "record" |
Date: | 2005-11-30 17:53:19 |
Message-ID: | c2d9e70e0511300953q78c566a3md4d043e9e0628bb9@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
On 11/30/05, AUGUSTO ESTEBAN <augustin_hm(at)yahoo(dot)es> wrote:
>
> > Saludos, esto asumo que debe ser pichanga para ud.
> > bien soy casi nuevo en esto de plpgsql y tengo el siguiente codigo y
> quiero que me devuelva esa simple consulta(que porsupuesto lo puedo hacer en
> una vist ano ma, pero no se trrata de eso) y me devuelve el siguiente error,
> no me imagino porque, porfavor si alguien me pudiese ayuduar, se lo
> agradeceria.
> > ----------------------------------------------------------------------
> > -------- ERROR : a column definition list is required for functions
> > returning "record"
> > ----------------------------------------------------------------------
> > -------- CREATE OR REPLACE FUNCTION f_a_prrueba3()
> > RETURNS SETOF record AS
> > $BODY$
> > declare
> > resultado record;
> > begin
> > for resultado in
> > select * from nota
> > loop
> > return next resultado;
> > end loop;
> > return;
> > end;$BODY$
> > LANGUAGE 'plpgsql' VOLATILE;
> > ----------------------------------------------------------------------
> > --------
> > select * from f_a_prrueba3();
Para retornar un tipo record tienes que indicar la estructura cuando
llamas el select
select * from f_a_prrueba3() as (campo1 int, campo2 varchar(30), etc, etc);
--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)
From | Date | Subject | |
---|---|---|---|
Next Message | Ing. Jhon Carrillo // Caracas, Venezuela | 2005-11-30 17:56:32 | Re: a column definition list is required for functions returning "record" |
Previous Message | Raul Caso | 2005-11-30 17:53:16 | Re: a column definition list is required for functions returning "record" |