3 ms·
One the worst systems I worked on was tons of untested PL/SQL. Could not change anything without unknowingly breaking something.
by UK-Al05 6y ago
One the worst systems I worked on was tons of untested PL/SQL. Could not change anything without unknowingly breaking something.
- ajuc 6y agoIt was pretty good code as far as PL/SQL goes. All the functions were divided into packages and followed this template: function (inParam1, ..., inParamN, outParam1, ..., outParamN, outMessage): ReturnType begin savepoint SP_begin; -- do stuff outMessage := '...'; return RESULT_OK; exception when ... when others then rollback to SP_begin; outMessage := '...' || exception details || ' ...'; return RESULT_ERROR; end; It's funny how I remember this after more than 10 years :) Made it very easy to add tests and to interoperate with container-managed-transactions in EJB3. I even added an debug-only interceptor on EJB that created a savepoint before calling any PL/SQL and checked if that savepoint was still valid after the call. If no - that's a PL/SQL that isn't following the template and the developer who changed it needs to be flogged ;)