Is this good coding practice?

A consultant developer just handed me code with the following exception clause.

EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN 0;
WHEN OTHERS
THEN
RETURN 0;
END XXXXXXXXXXX;

Now, I’m no developer, but what the heck is that point of that mess? Regardless of what exception comes up, always return the same exception code. And if that’s not bad enough, always return 0, meaning everything is OK.

Sigh.

1 thought on “Is this good coding practice?

  1. I think I can help you out here. First, it looks like someone has really taken Tom Kyte’s “‘When others then null’ is bad for you” advice to heart. After all, as everyone knows, zero is certainly *not* NULL. Then, it’s doubly useful, because there’s also no need to ever be troubled by *which* exception was thrown!

    I’m not seeing the problem here.

    😛

Leave a Reply

Your email address will not be published. Required fields are marked *