Embarrassing Moments

time to read 5 min | 854 words

Sometimes I make mistakes that has no reason whatsoever. It's like I developed a sudden blank spot in a particular area for a while. I had a piece of code similar to this one (PL/SQL, nonesense code):

for rec0 in sql_data   

      if rec0.Status == 3 then     

            v_Foo = rec.Foo

      end if;

            open bar

                  loop exit when NO_DATA_FOUND

  fetch v_bar into v_Da

update Fubars

SET Foo = v_Foo + rec0.Bar + v_Da

where rec0.rowid = rec0.rowid

 

end loop;

end loop;

I, and two developers with quite a bit of expeirance in Oracle couldn't figure what this does. Oh, we knew what the code is doing, but no how it was doing it. The issue was with the identing of the code (which was worse in the original code). It took a trip to the help files to find out what is going on.

In the meantime this actually started an escelation procedure. Luckily it was caught in time (not by me, by the way), and then we had a good laugh about how blind we were. I would hate to see the look on the face of the expert we would've shown this to (or to think about approaching him ever again...).