Is it possible to create custom conditions when I raise an exception? Consider the following example:
BEGIN
y := x / 0;
EXCEPTION
WHEN division_by_zero THEN
RAISE NOTICE 'caught division_by_zero';
RETURN x;
END;
Here I use 'division_by_zero' condition to catch the exception. What I'd like to do is something like this:
BEGIN
[...]
RAISE custom_condition;
EXCEPTION
WHEN custom_condition THEN
[...]
END;
so that I don't interfere with possible standard exceptions. I could just do y:= 1 / 0; and catch division_by_zero, but it does not look right.