begin
    ......  --程序
exception
    when [Exception Name] then
        处理....
    when [Exception Name] then
        处理....
    when others then
        处理
end;

解决方案 »

  1.   

    begin
        ......  --程序
    exception
        when [Exception Name] then
            处理....
        when [Exception Name] then
            处理....
        when others then
            处理
    end;
      
     这里的Exception Name 如何定义?比如:create or replace procedure ccc
    as
    begin
    insert into table1(a,b) values ('a','b');insert into table2(a,b) values ('a','b');
    exception
    when table1
      对table1插入错误处理
    when table2
     对table2插入错误处理end ccc; 这里的错误处理的名字如何定义?
      

  2.   

    在PL/SQL,你可以使用SQLCODE和SQLERRM来获取错误号和错误信息。
    通常用异常处理就可以了。异常可以是系统预先定义的,也可以是自定义,用raise进行抛出。