Re: Como devolver datos de un select q esta con group by y count() por medio de una funcion

From: Álvaro Hernández Tortosa <aht(at)nosys(dot)es>
To: luis antony meza alania <luchonet7(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Como devolver datos de un select q esta con group by y count() por medio de una funcion
Date: 2011-08-26 08:32:53
Message-ID: 4E575A35.4090104@nosys.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola, Luis. El mensaje de error es claro: estás devolviendo un
bigint y un text, no un registro de tipo AuditoriaCatastro. Devuelve
"SETOF RECORD" en su lugar.

Saludos,

Álvaro

--
Álvaro Hernández Tortosa

-----------
NOSYS
Networked Open SYStems

El 25/08/11 21:32, luis antony meza alania escribió:
> hola amigos quiero q me ayuden con este codigo
>
> CREATE OR REPLACE FUNCTION auditoria_fichas(fecha date,codper text)
> RETURNS SETOF "AuditoriaCatastro"
> AS
> $$
> SELECT count(*),"CodPersonal"
> FROM "AuditoriaCatastro"
> where "TableName"='TI_Unicat' and "Operation"='INSERT' and "NewValue"
> not in (select "OldValue" from "AuditoriaCatastro" where
> "Operation"='DELETE')
> and extract(hour from "UpdateDate") between 8 and 16 and
> cast(to_char("UpdateDate",'YYYY-MM-DD') as date)='2011-08-25'
> group by "CodPersonal"
>
> $$
> LANGUAGE SQL;
>
> me sale un error
> que esto :
> ERROR: el tipo de retorno de función declarada para retornar
> "AuditoriaCatastro" no concuerda
> DETAIL: La sentencia final retorna bigint en lugar de integer en la
> columna 1.
> CONTEXT: función SQL «auditoria_fichas»
>
> ********** Error **********
>
> ERROR: el tipo de retorno de función declarada para retornar
> "AuditoriaCatastro" no concuerda
> SQL state: 42P13
> Detail: La sentencia final retorna bigint en lugar de integer en la
> columna 1.
> Context: función SQL «auditoria_fichas»
>
> quiero q me den la solucion
> bueno saludos!!!

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Cesar A 2011-08-26 13:34:01 Re: FUNCION PASSWORD() PARA POSTGRES
Previous Message Miguel Angel Hernandez Moreno 2011-08-25 20:50:57 Re: Significado de 'Cursor', para los que lo desconocen.