我想在FREIGHTS表中创建新行后创建触发器,该触发器应在表INVOICES中创建新行。触发器应从表FREIGHTS获取值并将其放在表INVOICES中。
现在它看起来如下:
create or replace TRIGGER NewInvoice
AFTER INSERT ON FREIGHTS
FOR EACH ROW
BEGIN
INSERT INTO INVOICES(id, netvalue, grossvalue, tax, receipient)
SELECT '1', '1', weight, '1', '1'
FROM FREIGHTS
END;
错误发生在最后的END声明中。
提前感谢您的支持;)
答案 0 :(得分:1)
假设权重是FREIGHTS表中的一列:
create or replace TRIGGER NewInvoice
AFTER INSERT ON FREIGHTS
FOR EACH ROW
BEGIN
INSERT INTO INVOICES(id, netvalue, grossvalue, tax, receipient)
values ('1', '1', :new.weight, '1', '1');
END;
也许请阅读docs?