create or replace trigger Tri
before insert or update on do_enterprotocol
for each row
declare
-- local variables here
roomsn varchar(20);
cnt integer;
begin
/*
功能:用于控制************ 作者:高飞龙
编写日期:2005.9.1
*/
select nvl(count(*),0) into cnt from A where sn = :New.ID;
if cnt = 0 then
RAISE_APPLICATION_ERROR(-20999,'非法的');
end if;
end TRI;
本文介绍了一个使用PL/SQL编写的数据库触发器,该触发器在插入或更新操作前检查目标表中是否存在特定记录,如果不存在,则抛出错误。此机制有助于确保数据的一致性和完整性。
913





