我試圖創建項目時在訂單表都進入了產品表中的數量是假設減少如何創建更新觸發器
create or replace trigger quantity_dicr after update of quantity on products for each row
declare
quantity float;
begin
select quantity into quantity from products where o_id = :new.o_id;
set quantity = quantity + :new.quantity ,
where o_id= :new.o_id;
end quantity_dicr;
表,將運行觸發器
create table products(
prod_id numeric not null,
prod_name varchar2(50) not null,
quantity numeric not null,
price numeric not null,
constraint prod_id_pk primary key(prod_id)
)
create table orders
(
prod_id numeric not null,
o_id numeric not null,
quantity numeric not null,
o_sum numeric not null,
constraint fk_products foreign key (prod_id) references products(prod_id),
constraint orders_pk primary key (o_id))
)
它給了我這些錯誤
Error(4,64): PLS-00049: bad bind variable 'NEW.O_ID'
Error(5,7): PL/SQL: SQL Statement ignored
Error(5,11): PL/SQL: ORA-00922: missing or invalid option
Error(6,19): PLS-00049: bad bind variable 'NEW.O_ID'
任何可以遮光的幫助爲什麼有這些錯誤將有助於全
表中產品沒有字段O_ID –