程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了为 ship_status_af_update 创建 Oracle TRIGGERS大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决为 ship_status_af_update 创建 Oracle trigGERS?

开发过程中遇到为 ship_status_af_update 创建 Oracle trigGERS的问题如何解决?下面主要结合日常开发的经验,给出你关于为 ship_status_af_update 创建 Oracle trigGERS的解决方法建议,希望对你解决为 ship_status_af_update 创建 Oracle trigGERS有所启发或帮助;

我需要创建一个名为“shipment_status_af_update”的触发器,每当shipment_status 表更新时就会触发它。 该触发器将在shipment_status 细节更新后将名称和动作插入到表'status_log_history' 中。 受影响的日志表 status_log_history 中的操作名称是“After_update_Shipment_Status”。

Hints:
trigger name : shipment_status_af_update
table name : status_log_history
FIEld names :name,action
Action  : 'After_update_Shipment_Status'.
Hint: Add / after the end statement

我的代码是:

CREATE or replaCE trigGER shipment_status_af_update
AFTER updatE on shipment_status FOR EACH ROW declare
BEGIN

insert into status_log_history  (name,action) 
values(:new.name,'After_update_Shipment_Status');

END;
/

结果: 警告:触发器创建时有编译错误。

解决方法

如果两个表都存在并且包含您在触发器中使用的名称,则代码编译:

SQL> create table shipment_status (name VARCHAR2(20));

Table created.

SQL> create table status_log_history(name VARCHAR2(20),action varchar2(30));

Table created.

SQL> create or replace trigger shipment_status_af_update
  2    after update on shipment_status
  3    for each row
  4  declare
  5  begin
  6    insert into status_log_history (name,action)
  7    values (:new.name,'After_update_Shipment_Status');
  8  end;
  9  /

trigger created.

SQL>

大佬总结

以上是大佬教程为你收集整理的为 ship_status_af_update 创建 Oracle TRIGGERS全部内容,希望文章能够帮你解决为 ship_status_af_update 创建 Oracle TRIGGERS所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。