Why is this an issue?
An EXCEPTION WHEN ... THEN
clause that only rethrows the caught exception has the same effect as omitting the EXCEPTION
clause altogether and letting it bubble up automatically, but with more code and the additional detriment of leaving maintainers scratching their
heads.
Such clauses should either be eliminated or populated with the appropriate logic.
Noncompliant code example
BEGIN
SELECT 1/0;
EXCEPTION
WHEN ZERO_DIVIDE THEN
RAISE; -- Noncompliant
WHEN OTHERS THEN
RAISE; -- Noncompliant
END;
Compliant solution
BEGIN
SELECT 1/0;
EXCEPTION
WHEN ZERO_DIVIDE THEN -- Compliant: handles 'division by zero' error
-- do something to manage the division by zero
COMMIT;
WHEN OTHERS THEN
ROLLBACK;
END;