0
我创建了一个列表product_id
和total_count
的库存表。当在采购表中输入采购时(purchase_id
,supplier_id
,product_id
,price, quantity
),它应更新库存表中的total_count。库存表中total_count的默认值为0.触发器通过在另一个表中添加计数/数量来更新一个表中的Total_count列
例如,当进行采购(供应商,充电器,价格,25)时,应更新库存(充电器,25)。
我无法做到这一点。这里是我的代码:
create or replace trigger trg_update_inventory
after insert on supplier_product
for each row
begin
update inventory set total_count=total_count+ quantity where .....
我停留在这一点上。我如何让触发器从购买表中获取数量并更新总余额?