I found similar code this morning, but in this case the perpetrator had managed to make it even less efficient by using an exception handler to recursively call the procedure (containing a MERGE) with an incrementing p_error_attempts parameter.

Did this code come from forms? I have myself done things like that where they system can easily go into infinite loops and forms is one of those. I'm not going into details but there are some interpreted systems where it is exceedingly easy for the system to start looping. Typically some kind of reset or exception can trigger it. That causes people to put in loop stoppers like this. The underlying problem is the interpreter doesn't detect and stop loops. I wouldn't complain about it unless you like programs where the only way to halt a loop is to kill the whole thing and lose all your data.

The only reason I can see for codinglike this is if one is programmingagainst a blocking server like SQLite - where only one user is allowedaccess the database (1 file in thiscase) at any given instant - so youtry 127 times - but since PL/SQL doesn'twork against SQLite (or is there somethingI should be told?