Re: ayuda con trigger

From: juan <juanramirez(at)cajazacate(dot)com(dot)sv>
To: Virginia <mavir78(at)gmail(dot)com>
Cc: Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: ayuda con trigger
Date: 2009-06-22 17:36:42
Message-ID: 4A3FC12A.8060405@cajazacate.com.sv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Diego Ayala 2009-06-22 19:35:25 Re: excepcion en postgres
Previous Message Jose Vasquez 2009-06-22 17:17:48 Re: Sobre los TableSpaces