Edson Carlos Ericksson Richter wrote : 
>
>I've found an old mail saying that OLD and NEW works only in UPDTE 
>triggers. So, should I not use OLD in DELETE trigger too?
>
>Thanks,
>
>Richter
>
>
>Edson Carlos Ericksson Richter escreveu:
>
>> Thank you, you is right. I forgot the brackets...
>> But now, if I stay with "if old.CO_SITUACAO <> 2", I get "Table name 
>> must be in from list". If I remove the IF line, compiles ok.
>>
>> Any hints?
>>
>> Richter
>>
>>
>> Frank Schimmelpfennig escreveu:
>>
>>> Hi,
>>>
>>> perhaps it helps to put the trigger logic between brackets... Pls. 
>>> see the
>>> code modifications below:
>>>
>>> create trigger TRG_PARCELA_DEL for TB_PARCELA
>>>  after delete
>>>    execute (
>>>      if old.CO_SITUACAO <> 2 then
>>>        UPDATE MGR.TB_CC_ORCAMENTO
>>>          SET VL_PROVISIONADO = VL_PROVISIONADO - 
>:old.VL_NOMINAL_REAIS
>>>          ,VL_PAGO = VL_PAGO - :old.VL_PAGO
>>>          WHERE EXISTS
>>>            (SELECT *
>>>              FROM MGR.TB_TITULO T3
>>>              WHERE T3.NU_TITULO = :old.NU_TITULO
>>>              AND MGR.TB_CC_ORCAMENTO.CO_CONTABIL = T3.CO_CONTABIL_CR
>>>              AND date(T3.DT_EMISSAO) BETWEEN 
>TB_CC_ORCAMENTO.DT_INICIO
>>>              AND TB_CC_ORCAMENTO.DT_FIM);
>>>    )
>>> //
>>>
>>>
>>> kind regards
>>> Frank
>>>
>>>
>>>                                                             

Yes, that's true. You should still omit 'old' inside DELETE triggers,
since 'old' is assumed
implicitly. However, it would be nice to be able to specify 'old'
explicitly, but that is
still on our TODO list.

Best Regards,
Thomas

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to