PL/SQL, I miss you...

I was a coder for 13 years before making moving into a management/leadership role in IT. I haven't coded for almost 18 months now.

The following is an email I received from one of my former coder coworkers that made me laugh. (Probably have to be a coder to appreciate :-)

From: Brad
Sent: Thursday, February 17, 2011 8:10 AM
To: Jordan Hodges
Subject: RE: Half-full or Half-empty
Nifty indeed … some of that modern-day fancy PL/SQL stuff that most of us have never seen, let alone used

Procedure: MESSAGE.PKG_MESSAGES.Log Message
--Some nifty code if I do say so myself, MERGE acts as an insert or update
--depending on what the ON clause brings back from the SELECT statement
--If there is a match then we do an update and append the callstack if not
--we do an insert
MERGE INTO message.messages msg
USING (SELECT ai_strMessage message
, ai_strStack callstack
, l_strType messagetype
, SYSDATE messagedate
, s.osuser osuser
, s.username loggedbyusername
, s.module callingprogram
, s.machine machinename
, s.audsid sessionid
FROM v$session s
WHERE s.username IS NOT NULL
AND NVL(s.osuser,'x') <> 'SYSTEM'
FROM dual)) e
ON (msg.message = SUBSTR(ai_strMessage
AND msg.messagedate BETWEEN (e.messagedate - (10/86400)) AND e.messagedate
AND msg.sessionid = e.sessionid
AND msg.osuser = e.osuser)
UPDATE SET msg.callstack = DECODE(msg.callstack
,msg.callstack||'<-'||e.callstack) WHEN NOT MATCHED THEN INSERT (msg.message , msg.callstack , msg.messagetype , msg.messagedate , msg.osuser , msg.loggedbyusername , msg.callingprogram , msg.machinename , msg.sessionid) VALUES (e.message , e.callstack , e.messagetype , e.messagedate , e.osuser , e.loggedbyusername , e.callingprogram , e.machinename , e.sessionid);

-----Original Message-----
From: Jordan Hodges
Sent: Wednesday, February 16, 2011 4:16 PM
To: Bra
Subject: Re: Half-full or Half-empty

Haha. Always half full. Now my question is, was the code indeed nifty? I'm dying to know what the code was....

Brad wrote:


I believe it must depend on how your day is going, and whether your cup is appearing half-full or half-empty, in whether one “feels warm’n’cozy in the gut” or “begins to quiver in their boots” when examining old PL/SQL code with programmer comments “Some nifty code if I do say so myself”


Popular Posts