Predefined exceptions are internally defined exceptions but they have names. Oracle database raise this type of exceptions automatically.
Example
create or replace procedure insert_emp
is
begin
insert into emp (emp_id, ename) values ('1','Jon');
exception
when dup_val_on_index then
dbms_output.put_line('Duplicate value on index!');
end;
/
Below are examples exceptions name with theirs codes:
Exception Name | Error Code |
---|---|
NO_DATA_FOUND | -1403 |
ACCESS_INTO_NULL | -6530 |
CASE_NOT_FOUND | -6592 |
ROWTYPE_MISMATCH | -6504 |
TOO_MANY_ROWS | -1422 |
ZERO_DIVIDE | -1476 |
Full list of exception names and their codes on Oracle web-site.