From: | Fellipe Henrique <fellipeh(at)gmail(dot)com> |
---|---|
To: | Tulio <tulio(at)informidia(dot)com(dot)br> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Tigger after delete with plpgsql |
Date: | 2012-08-31 18:14:15 |
Message-ID: | CAF1jwZFAgQjMGqvSuRheb3QOTTL8LYrb+Byh-p=m-q2TpiMNuA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I`m using Before Delete..
CREATE TRIGGER nfentrada_item_tr1
BEFORE DELETE
ON public.nfentrada_item FOR EACH ROW
EXECUTE PROCEDURE public.nfentrada_item_ad0();
here is my nfentrada_item_ad0();
delete
from MOVIMENTO
where (IDEMPRESA = OLD.idempresa) and
(upper(TABELA) = 'NFENTRADA_ITEM') and
(CODIGO = OLD.idnfentrada_item);
return old;
I just want to delete all row in my MOVIMENTO table with these
conditionals..
Thanks,
T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*
*"Life is a game without Tutorial"*
*http://fellipeh.eti.br*
2012/8/31 Tulio <tulio(at)informidia(dot)com(dot)br>
> Hi,
>
> You're using a trigger AFTER, in your case could be BEFORE?
> Cause when you use AFTER the var OLD not exists...
> I don't know if I understand exactly what you'll do to ativate this
> trigger..
> but I think maybe is it..
>
> try..
>
>
> Em 31/08/2012 14:10, Fellipe Henrique escreveu:
>
> Hello, I`m try to use this code for my After Delete trigger:
>
> delete
> from MOVIMENTO
> where (IDEMPRESA = OLD.idempresa) and
> (upper(TABELA) = 'NFENTRADA_ITEM') and
> (CODIGO = OLD.idempresa_item);
>
> But, when execute. show me error.. that`s says
>
> "old is not initialize" (sorry,but I dont know how exactly error msy
> because in my SO, give in portuguese)..
>
> my question is: how can I use OLd and NEW in posgre?
>
> Best Regards,
>
>
> T.·.F.·.A.·. S+F
>
> *Fellipe Henrique P. Soares*
>
> *"Life is a game without Tutorial"*
>
> *http://fellipeh.eti.br*
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2012-08-31 18:25:25 | Re: Refreshing functional index |
Previous Message | Tulio | 2012-08-31 18:04:15 | Re: Tigger after delete with plpgsql |