触发更新另一个表
CREATE TRIGGER update_orderline
AFTER INSERT OR UPDATE ON ORDERS
FOR EACH ROW
BEGIN
INSERT INTO ORDERLINE(orderline_no, qty, order_no, product_no)
VALUES (ol_no.nextval, :new.qty, :new.order_no, :new.product_no);
END;
我正在尝试创建一个触发器,在将新记录插入订单后更新订单行表。但我收到这个错误:
Error(3,26): PLS-00049: bad bind variable 'NEW.QTY'
Error(3,51): PLS-00049: bad bind variable 'NEW.PRODUCT_NO'
CREATE TRIGGER update_orderline
AFTER INSERT OR UPDATE ON ORDERS
FOR EACH ROW
BEGIN
INSERT INTO ORDERLINE(orderline_no, qty, order_no, product_no)
VALUES (ol_no.nextval, :new.qty, :new.order_no, :new.product_no);
END;
I am trying to create a trigger that updates orderline table after a new record has been inserted into orders. But I get this error:
Error(3,26): PLS-00049: bad bind variable 'NEW.QTY'
Error(3,51): PLS-00049: bad bind variable 'NEW.PRODUCT_NO'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我不得不猜测订单表没有名为“order_no”和“product_no”的列。我可以重现这种情况下的错误并获取绑定变量消息。那么订单表的列名是什么?
更新:根据您的评论,无法从 order_no 或 Product_no 或 qty 中获取新值。您期望这些值从哪里来?
更新:根据您的更新,订单表中有以下列:
在该列列表中,我没有看到 Product_no 或 qty。但 Order_no 就在那里。
If I had to guess the orders table does not have columns named 'order_no' and 'product_no'. I can reproduce the error in that case and get the bind variable message. So what is the orders table column names?
UPDATE: there is nothing to get the new value from for order_no or product_no or for that matter qty according to your comment. Where do you expect the values to come from?
UPDATE: Accordin to your update you have the following columns in the orders table:
In that list of columns I do not see product_no or qty. Order_no is there though.
我想我找到了。
看这里:http://www.tek-tips.com/ viewthread.cfm?qid=1556226&page=14
I think I found.
Look here : http://www.tek-tips.com/viewthread.cfm?qid=1556226&page=14