create or replace trigger "档号重复提示"
before insert on s3_main_wsda
for each row
declare hj number;
begin
select count(s3_dh) into hj from s3_main_wsda where s3_sjly<>'历史档案' and s3_sjly<>'历史资料' and s3_jgid=:new.s3_jgid and s3_dh=:new.s3_dh and s3_sjly=:new.s3_sjly and (s3_isdelete=0 or s3_isdelete is null );
if hj<>0 then
raise_application_error(-20011,'<!系统允许插号,但不允许重号!>');
rollback;
end if;
end;