Untitled
unknown
plain_text
7 months ago
352 B
4
Indexable
create or replace function restore_product_quantity()
returns trigger as $$
begin
update products
set quantity = quantity + OLD.quantitysold
where productid= old.productid;
return old;
end;
$$ language plpgsql;
create trigger after_sale_delete
after delete on sales
for each row
execute function restore_product_quantity();Editor is loading...
Leave a Comment