Subject | Re: [firebird-support] How can i update multiple rows after a delete? |
---|---|
Author | Fabio Gomes |
Post date | 2005-11-21T09:56:56Z |
Just another question,
How can i make a function to update the actual_stock after i delete a row?
This works when i insert a row:
CREATE TRIGGER SCI ACTIVE AFTER INSERT AS
BEGIN
UPDATE STOCK
SET ACTUAL_STOCK = ACTUAL_STOCK + NEW.STOCK_ADDED
WHERE PRO_ID = NEW.PRO_ID;
END
I want to make something like it:
SELECT Pro_Id, sum(Quantity) On_Hand
FROM StockControl
WHERE Pro_Id = :Pro_Id
I think that i need to make a function that actived after i delete
something, than it sum all the stock for that product and write it on the
actual_stock on the other table.
is there some way to do it?
Thanks guys :)
[Non-text portions of this message have been removed]
How can i make a function to update the actual_stock after i delete a row?
This works when i insert a row:
CREATE TRIGGER SCI ACTIVE AFTER INSERT AS
BEGIN
UPDATE STOCK
SET ACTUAL_STOCK = ACTUAL_STOCK + NEW.STOCK_ADDED
WHERE PRO_ID = NEW.PRO_ID;
END
I want to make something like it:
SELECT Pro_Id, sum(Quantity) On_Hand
FROM StockControl
WHERE Pro_Id = :Pro_Id
I think that i need to make a function that actived after i delete
something, than it sum all the stock for that product and write it on the
actual_stock on the other table.
is there some way to do it?
Thanks guys :)
[Non-text portions of this message have been removed]