我需要创建一个名为'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;
/结果:警告:触发器创建时出现编译错误。
发布于 2021-05-30 00:59:47
如果这两个表都存在并且包含您在触发器中使用的名称,则代码将编译:
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>https://stackoverflow.com/questions/67749849
复制相似问题