oracle pragma 例外用法(1)

declare
  a int;
  e_x exception;
  pragma exception_init(e_x, -6502);
begin
  select 'a' into a from dual;
exception
  when e_x then
    dbms_output.put_line('asdfasdf');
end;

由於ORACLE 中類型轉換錯誤 代號為 -6502,

為了顯示方便, 就自定義一個例外e_x 和 -6502聯繫起來,

到時候報錯誤的就是自己的文字了'asdfasdf'

posted on 2011-06-07 18:11  Mayvar  阅读(454)  评论(0编辑  收藏  举报

导航