Subject | Re: master updation using trigger |
---|---|
Author | Adam |
Post date | 2006-07-30T23:17:37Z |
--- In firebird-support@yahoogroups.com, "Sudheer Palaparambil"
<sudheer.clt@...> wrote:
Adam
<sudheer.clt@...> wrote:
>NEW.product_id);
> Hello,
>
> Is it safe to reduce the quantity and check for closing stock in the
> product master file using a trigger like this in a multi-user
> environment?
>
> Trigger for sale_det before insert :-
>
>
> IF ( NEW.cancelled = 0 ) THEN BEGIN /* Not cancelled. */
> UPDATE product SET closing = closing - ( NEW.quantity + NEW.free )
> WHERE ( company_id = NEW.company_id ) AND ( product_id =
>NEW.product_id)
> SELECT closing FROM product
> WHERE ( company_id = NEW.company_id ) AND ( product_id =
> INTO :liClosing;No
>
> IF ( liClosing < 0 ) THEN EXCEPTION INVALID_SALE_QUANTITY;
> END
Adam