RE: Buenos dias lista

From: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
To: <paulonunex(at)gmail(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: Buenos dias lista
Date: 2009-01-27 14:02:43
Message-ID: BLU137-W40A8C677DB74FF1E47411DE3CB0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda


Y cual es la pregunta?

*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-849-8087

* " Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo comun"
*-------------------------------------------------------*

________________________________
> Date: Mon, 26 Jan 2009 11:28:57 -0300
> Subject: [pgsql-es-ayuda] Buenos dias lista
> From: paulonunex(at)gmail(dot)com
> To: pgsql-es-ayuda(at)postgresql(dot)org
>
> Amigos:
> Soy nuevo en esta lista me gustaria si me pueden ayudar con el siguiente tema.
> tengo un trigger creado en Oracle y ahora estamos migrando a Postgresql, bueno mi funcion disparadora es la siguiente
>
> CREATE OR REPLACE FUNCTION SUMA_INGRESO() RETURNS trigger AS $$
>
> BEGIN
> IF (TG_OP = 'INSERT') OR (TG_OP = 'UPDATE') THEN
> if new.CGINGRESO_VNETO != 0 then
> update cg_ingegre
> set CGINGEGRE_TINGRE = CGINGEGRE_TINGRE + new.CGINGRESO_VNETO
> where mgempre_cod = new.MGEMPRE_COD
>
> and CGPRODUCTOR_IDR = new.CGPRODUCTOR_IDR
> and CGFPROC_AAAA = new.CGFPROC_AAAA
> and CGFPROC_MM = new.CGFPROC_MM;
> end if;
> end if;
>
> IF (TG_OP = 'DELETE') OR (TG_OP = 'UPDATE') THEN
> if old.CGINGRESO_VNETO != 0 then
>
> update cg_ingegre
> set CGINGEGRE_TINGRE = CGINGEGRE_TINGRE - old.CGINGRESO_VNETO
> where mgempre_cod = old.MGEMPRE_COD
> and CGPRODUCTOR_IDR = old.CGPRODUCTOR_IDR
> and CGFPROC_AAAA = old.CGFPROC_AAAA
>
> and CGFPROC_MM = old.CGFPROC_MM;
> end if;
> end if;
> end;
> $$ LANGUAGE plpgsql;
>
> el trigger que lo llama es:
>
> CREATE TRIGGER "ICG_INGRESO"
> AFTER INSERT OR UPDATE OR DELETE
>
> ON cg_ingreso
> FOR EACH ROW
> EXECUTE PROCEDURE suma_ingreso();
>
> Este trigger no es mas que una suma ascendente.
> De antemano muchas gracias amigos
>
>

_________________________________________________________________
See how Windows® connects the people, information, and fun that are part of your life
http://clk.atdmt.com/MRT/go/119463819/direct/01/

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Edwin Quijada 2009-01-27 14:04:09 RE: replica en fedora
Previous Message Emanuel Calvo Franco 2009-01-27 13:56:52 Re: Respaldar la BD