Reputation: 332
I would like to catch specific exception for exception "ORA-06535: statement string in OPEN is NULL or 0 length"
But couldn't figure out the exact "exception name" for it. Please note I don't want to catch it under generic other exceptions block..
EXCEPTION
WHEN <exception_name1>
THEN
executable_statements;
WHEN <exception_nameN>
THEN
executable_statements;
WHEN OTHERS
THEN
executable_statements;
END;
Upvotes: 2
Views: 12062
Reputation: 5170
Some exceptions have names such as 'TOO_MANY_ROWS'. However, most of oracle exceptions do not have names. So if you want to trap any of them, you need to give them names.
For your exception, you can do something like this:
DECLARE
....
NULL_STRING EXCEPTION;
PRAGMA
EXCEPTION_INIT(NULL_STRING, -06535);
....
Begin
......
EXCEPTION
WHEN NULL_STRING THEN
executable_statements;
.....
END;
Upvotes: 8