Oracle Trigger: Setting VIP Member's v_count to 0 for Non-'ABC Company' Jobs
create or replace trigger tri_vip
-- This trigger is created to check if the job of a VIP member is from 'ABC Company'.
-- If not, the v_count column is set to 0 before insert or update.
before insert or update
on vip
for each row
begin
if :new.v_job!='ABC公司' then
:new.v_count:=0;
end if;
end;
/
This trigger checks if the job of a VIP member is from 'ABC Company'. If not, the v_count column is set to 0 before inserting or updating the VIP member record. This ensures that only VIP members with a job from 'ABC Company' have a non-zero v_count value.
原文地址: https://www.cveoy.top/t/topic/oBQ0 著作权归作者所有。请勿转载和采集!