declare v_a A.a%type; v_b B.b%type; begin begin select a into v_a from A where 1>2; Exception when NO_DATA_FOUND then raise_application_error(-20001,'未找到产品'); end; begin select b into v_b from B where 1>2; Exception when NO_DATA_FOUND then raise_application_error(-20001,'无此合同'); end; end; /
begin sql statement exception when ... then sql statement when others then sql statement end; 基本都是类似与这样的SQL
v_a A.a%type;
v_b B.b%type;
begin
begin
select a into v_a from A where 1>2;
Exception
when NO_DATA_FOUND then raise_application_error(-20001,'未找到产品');
end;
begin
select b into v_b from B where 1>2;
Exception
when NO_DATA_FOUND then raise_application_error(-20001,'无此合同');
end;
end;
/
sql statement
exception
when ... then
sql statement
when others then
sql statement
end;
基本都是类似与这样的SQL
update delete?
那就加sql%rowcount 然後if裡面 raise exception就行了~剩下的就是上面哥們們寫的方式~