oracle 字段非空时唯一的触发器
如题我建了一个简单的表
create table test(id number not null,name varchar2(64),code varchar2(18))
creater or replace trigger tg_testbefore update of code on test for each rowdeclare cnt number;exp_err exception;beginselect conut(*) into from test where (code is not null) and code=:new.code;if cnt!=0 thenraise exp_err;end if;exceptionwhen exp_err thenraise _application_error(-22222,'重复');end;