trigger練習0414

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;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章