create or replace trigger con_sex_trigger
before insert on consumer for each row
declare
ex_con_sex exception;
begin
if :new.con_sex not in ('m','f') then
raise ex_con_sex;
end if;
exception
when ex_con_sex then
dbms_output.put_line('con_sex只能是m或者f');
end;
没提示错误,但是没效果。。。 我是新手,求指导
------解决方案--------------------
楼主是这个意思把
create or replace trigger con_sex_trigger
before insert on consumer for each row
declare
begin
if :new.con_sex not in ('m','f') then
raise_application_error(-20002, 'con_sex只能是m或者f!!');--异常抛出
end if;
end;
------解决方案--------------------
你之前的那段代码也没错,但是你不要处理,就是说你最后一层异常不要再写exception处理了。