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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2707972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:30:02  来源:igfitidea点击:

Oracle Warning: execution completed with warning

sqloracleplsqltriggers

提问by GigaPr

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_ORDERwhen DELIVERYDATE is updated in Orders

我创建了一个触发器来更新 DELIVERYDATE 在ROLLINGSTOCK_ORDERDELIVERYDATE 更新时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.

警告:执行完成,警告 TRIGGER TRIGGER_UpdateDeliveryDate 已编译。

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?

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

  2. 触发器对我来说似乎没问题,你能发现问题吗?

Thanks

谢谢

采纳答案by APC

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.

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

回答by Peter Lang

You write

你写

BEGIN    
then

which is incorrect syntax. Are you missing an IF?

这是不正确的语法。你缺一个IF吗?

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

;UPDATE.



You might get the error using

你可能会得到错误使用

Show Error Trigger TRIGGER_UpdateDeliveryDate