存储过程常规语法:
实际业务例子:
CREATE OR REPLACE TRIGGER "TRI_B00_02_ONLY_GUID"
BEFORE/AFTER INSERT OR UPDATE OR DELETE ON B00_02
FOR EACH ROW
declare
t_guid varchar2(300) := ''; --GUID
t_cnt int := 0;
BEGIN
t_guid := :NEW.B00_02_09;
if t_guid is not null then
select count(1) into t_cnt from b00_02 t where t.b00_02_09 = t_guid;
if t_cnt > 0 then
raise_application_error('-20001', 'GUID已经存在,不允许插入!');
end if;
end if;
END;