Making The Wheel Round
Two days ago I posted about a
nasty
piece of code that I had to decipher. The code was very simple to
look at, just take the information in the transaction table and update the
customers with the current transactions summary.
What everyone who commented
(and me as well) missed is that this method is doing a bit more than just
update the customers table with the transactions. It also zeros the transaction
count / sum if the customer has no transactions!!!
I played with the code for
hours before it came up to me.
I am pretty sure that
this is an unintended side affect, but I had to duplicate it as well (not hard
once I knew what the difference was).
The problem? The SP (the code
I gave is in C#, because I refuse to write cursors on my spare time) run
in Oracle, which has such a fabulous support for debugging, and a
fantastic error reporting capabilities ("Procedure saved with
errors." What errors? Oracle knows, but he wants me to pay before
he will tell me. ARGH!)
The procedure run for three
hours under oracle using the cursor based logic, when I finally got
the SQL version to work, it run for 22 seconds, and I know that I'm
being inefficient there.
Comments
Comment preview