Oracle 警告:执行已完成,但有警告

发布于 2024-08-30 00:59:42 字数 834 浏览 5 评论 0原文

我有两个表

Orders(ID,ORDERDATE,DELIVERYDATE,GOODID,QUANTITY,COLLECTIONFROM,DELIVERYTO,NOTES)

,并且

ROLLINGSTOCK_ORDER(ORDERID,ROLLINGSTOCKID,DEPARTUREDATE,DELIVERYDATE,ROUTEID)

创建了一个触发器,当在 Orders 中更新 DELIVERYDATE 时更新 ROLLINGSTOCK_ORDER 中的 DELIVERYDATE

CREATE OR REPLACE TRIGGER TRIGGER_UpdateDeliveryDate
BEFORE UPDATE OF DELIVERYDATE ON Orders 
FOR EACH ROW 
BEGIN    
then
   UPDATE LOCOMOTIVE_DRIVER ld
   set ld.DELIVERYDATE = :new.DELIVERYDATE
   where ld.orderid = :new.id
end if;
END;

当我运行它时,我收到以下消息

警告:执行完成 警告触发 TRIGGER_UpdateDeliveryDate 已编译。

该警告没有向我提供任何信息,因此

  1. 我如何查看警告的详细信息?

  2. 我觉得触发器没问题,你能发现问题吗?

谢谢

I have two tables

Orders(ID,ORDERDATE,DELIVERYDATE,GOODID,QUANTITY,COLLECTIONFROM,DELIVERYTO,NOTES)

and

ROLLINGSTOCK_ORDER(ORDERID,ROLLINGSTOCKID,DEPARTUREDATE,DELIVERYDATE,ROUTEID)

i have created a trigger to update the DELIVERYDATE in ROLLINGSTOCK_ORDER when DELIVERYDATE is updated in Orders

CREATE OR REPLACE TRIGGER TRIGGER_UpdateDeliveryDate
BEFORE UPDATE OF DELIVERYDATE ON Orders 
FOR EACH ROW 
BEGIN    
then
   UPDATE LOCOMOTIVE_DRIVER ld
   set ld.DELIVERYDATE = :new.DELIVERYDATE
   where ld.orderid = :new.id
end if;
END;

When i run it i get the following message

Warning: execution completed with
warning TRIGGER
TRIGGER_UpdateDeliveryDate Compiled.

The warning does not give me any information so

  1. How can i see the details of the warning?

  2. The trigger seems ok to me can you spot the problem?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒几许 2024-09-06 00:59:43

本周早些时候,您提出了一个有关编写触发器来执行条件更新的问题。我发布了 两个如何实现这一目标的示例。您似乎所做的是将两个示例混合到一个无法编译的单一触发器中。

需要明确的是,您只需要以下之一。或者

BEFORE UPDATE OF DELIVERYDATE ON Orders

如果

 BEFORE UPDATE ON Orders 
 ... 
    if :new.delivery_date != :old.delivery_date then

您只有一个要应用的逻辑,请使用第一个选项。如果您希望触发器也处理其他逻辑部分(通常是这种情况),请使用第二个版本。

Earlier this week you asked a question on writing a trigger to execute a conditional update. I posted two examples of how to achieve that end. What you appear to have done is mash the two examples into a single spavined trigger which doesn't compile.

To be clear you need just one of the following. Either

BEFORE UPDATE OF DELIVERYDATE ON Orders

or

 BEFORE UPDATE ON Orders 
 ... 
    if :new.delivery_date != :old.delivery_date then

Use the first option if you just have the one piece of logic to apply. Use the second version if you want your trigger to handle other pieces of logic as well, which is usually the case.

埋葬我深情 2024-09-06 00:59:43

你写的

BEGIN    
then

语法不正确。您是否缺少 IF

您在 UPDATE 之后还缺少一个分号 (;)。


您可能会收到错误

Show Error Trigger TRIGGER_UpdateDeliveryDate

You write

BEGIN    
then

which is incorrect syntax. Are you missing an IF?

You are also missing a semicolon (;) after your UPDATE.


You might get the error using

Show Error Trigger TRIGGER_UpdateDeliveryDate
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文