请高手指点:
declare
error_xx exception;
v_count number;
begin
select count(*) into v_count from sale;
if v_count>0
then 在这里报错 end if;
end;
declare
error_xx exception;
v_count number;
begin
select count(*) into v_count from sale;
if v_count>0
then 在这里报错 end if;
end;
2. raise test;
create or replace procedure test_exception
declare
test exception;
v_con number;
begin
select count(*) into v_con from sale;
if v_con>0
then
raise test;
else
insert into sale values('201101',9999.00);
end if;
end;
declare
v_con number;
begin
select count(*) into v_con from sale;
if v_con>0
then
raise ;
else
insert into sale values('201101',9999.00);
end if;
exception
when others then
dbms_output.put_line('……');
end;
您好,我刚试了下! PL/SQL提示说有语法错误,我是新手!也不清楚哪里出的错误
你都raise test了,木有异常处理模块test当然报错了……
就好比你调用一个方法,木有这个方法。
v_con number;
test exception;
begin
select count(*) into v_con from sale;
if v_con > 0 then
raise test;
else
insert into sale values('201101',9999.00);
end if;
exception
when test then
dbms_output.put_line('OK1');
when others then
dbms_output.put_line('OK2');
end;