繁体   English   中英

每当在 Oracle DB 中的表中的行上发生插入或更新时,触发将记录更新到 null

[英]Trigger to update a record to null whenever there is an insert or update on a row in the table in Oracle DB

每当 Oracle DB 中的表中的行发生插入或更新时,需要帮助编写触发器以将记录更新到 NULL。

代码

create or replace trigger updateRowToNull
AFTER
UPDATE OR INSERT
ON CUSTOMER for each row
BEGIN
update customer set customeraddr=NULL;
END;

触发器不能通过单独的事务修改它附加到的表。 但是,“之前”触发器可以操纵事务中的列值,从而导致它被触发。

create or replace trigger update_row_to_null
before update or insert on customer
for each row
begin
   :new.customeraddr := null;
end;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM