Subject | master updation using trigger |
---|---|
Author | Sudheer Palaparambil |
Post date | 2006-07-30T13:26:38Z |
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 = NEW.product_id)
INTO :liClosing;
IF ( liClosing < 0 ) THEN EXCEPTION INVALID_SALE_QUANTITY;
END
Thank you.
Sudheer Palaparambil
[Non-text portions of this message have been removed]
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 = NEW.product_id)
INTO :liClosing;
IF ( liClosing < 0 ) THEN EXCEPTION INVALID_SALE_QUANTITY;
END
Thank you.
Sudheer Palaparambil
[Non-text portions of this message have been removed]