From this and this i guess, that there is no predefined Named System Exceptions for ORA-00955.
How can I rewrite the following to catch only the error ORA-00955?
begin
EXECUTE IMMEDIATE 'CREATE SEQUENCE S_TEST START WITH 1 INCREMENT BY 1';
exception when OTHERS then
Null;
end;
BTW Is there any syntax to catch errors by just providing the error-codes?
Best Answer
You have two options:
Refer to the exception directly by number:
Other option is to use
EXCEPTION_INIT
Pragma directive to bind a known Oracle error number to user defined exception;Yes, I've demonstrated it in the first example
Further reading for variations on this: