--大概类似如下 create table t( id int ); insert into t values(1);set serveroutput on; declare val int := 1; rowcou int := 0; morethanone exception; begin select count(1) into rowcou from t where id=val; if rowcou<>0 then raise morethanone; end if; exception when morethanone then dbms_output.put_line('当前记录已存在,请去生效'); end; /
--大概类似如下
create table t(
id int
);
insert into t values(1);set serveroutput on;
declare
val int := 1;
rowcou int := 0;
morethanone exception;
begin
select count(1) into rowcou from t where id=val;
if rowcou<>0 then
raise morethanone;
end if;
exception
when morethanone then
dbms_output.put_line('当前记录已存在,请去生效');
end;
/