Virginia escribió:
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
CONTEXT: PL/pgSQL function "historico_sobres" line 8 at SQL statement
La función es la siguiente:
CREATE OR REPLACE FUNCTION autoservicios.historico_sobres()
BEGIN
IF TG_OP = 'INSERT' THEN
select ((EXTRACT
(Y FROM (select dat_fecha from
autoservicios.toi019_acumulado where nu_co_empleado = NEW.nu_co_empleado
order by dat_fecha ASC LIMIT 1 offset 0 )) -1) || '-' ||
(select case when extract(month from dat_fecha) = 1 then '12'
else extract(month from dat_fecha) - 1 end
from autoservicios.toi019_acumulado where nu_co_empleado =
NEW.nu_co_empleado order by dat_fecha ASC LIMIT 1 offset 0 ) || '-' ||
'01') as fecha_nueva;
Que pretende hacer la parte anterior ??¿?¿
Si queres llenar la variable "fecha_nueva", tienes que hacerlo como la
siguiente línea
SELECT co_acumulado INTO codigo FROM bla bla bla
No podes utilizar un Select * from bla bla bla; si no pasas el valor
retornado del select a una variable.
--
Cordialmente,
Juan Ramírez
El Salvador
--
TIP 1: para suscribirte y desuscribirte, visita
http://archives.postgresql.org/pgsql-es-ayuda