Sebastian K.'s first encounter with Megan – a programmer in the company’s data verification department – came in the form of an innocent-sounding question: “how do I get the first value out of a variable?”

Having no idea what she was talking about, Sebastian inquired a bit further. Her code looked something like this:

iResult := agg_sum('rec-a',  0.11);
... snip ...
iResult := rlt_amtd(iAppNum) * 100;

“See,” Megan explained, pointing to the first line of code, “over here, I’m putting in the result of the first calculation, and then here I’m putting in the second result. But I need them both to do the deduction. So how do I get back the first value?”

Sebastian wasn’t quite sure how to respond. After all, Megan was responsible for developing several applications that were used by the data verification folks, and certainly couldn’t be asking such a basic programming question! He carefully replied, “Well, it looks like your iResult variable is getting overwritten by the second call here…”

Somewhat confused, Megan replied “so how do I fix that?”

Afraid that he might be insulting, Sebastian hesitantly took the keyboard and made a minor code change.

iAggResult := agg_sum('rec-a',  0.11);
... snip ...
iRltResult := rlt_amtd(iAppNum) * 100;

“Oh,” she said, “I didn’t know you could do that!”

Having found her go-to guy for programming help, Megan inquired with Sebastian about some difficulty she was having with a query. Sebastian took a look to see why …

SELECT *
FROM
(
	SELECT * FROM APPL WHERE APPRCVD IS NOT NULL
	UNION
	SELECT * FROM APPL WHERE APPRCVD IS NULL
)

Apparently, she wanted all rows, regardless of whether APPRCVD was null or not. When Sebastian explained that this would happen without a WHERE clause, she replied “I didn’t know you could do that!”

The following week, she called Sebastian over to help with her latest issue: errors about too many open cursors. A quick look at the code and it was pretty obvious why.

open myCursor(Id);
fetch myCursor into vrow;
if myCursor%NOTFOUND then
	pReturnMsg := 'Application Not Found';
	return True;
end if;
close myCursor;

Sebastian explained that it was important to close cursors after use. “But I’m doing that right here,” Megan said, pointing to the last line of the function. Sebastian further explained that the “return True” line caused the function to exit and not execute any lines below it. “Huh,” Megan replied, surprised, “I never knew that! That would explain a lot. I didn’t know you could do that!”

Over the next few months, Sebastian learned pretty quickly that “I didn’t know you could do that!” was Megan’s catchphrase. Fortunately, with all the programming help and tips, Megan started relying less and less on Sebastian. In fact, she had done so well that she was asked to help on other projects.

Previously, Megan’s code tended to be of the wrong-but-mostly-harmless category, but her new code approached wrong-and-very-freaking-dangerous.  Namely, she’d released an Oracle Forms application to production in which none of the fields were databound.  As such, any data submitted would never get recorded.  And it took them over two months to discover and fix this bug.

Once that was resolved, Megan went on to work on another application that updated several tables via a trigger.  The only problem was that she forgot to add a WHERE clause to the trigger’s UPDATE query.  Yes, every row of every table touched by the trigger would be updated every time the trigger fired.

So with all the screwups and bad data, the company responded appropriately.  By promoting Megan to the Lead Developer for the whole department.