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
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'
AND s.TYPE <> 'BACKGROUND'
AND s.audsid = (SELECT USERENV('SESSIONID')
FROM dual)) e
ON (msg.message = SUBSTR(ai_strMessage
,INSTR(ai_strMessage,msg.message)
,LENGTH(ai_strMessage))
AND msg.messagedate BETWEEN (e.messagedate - (10/86400)) AND e.messagedate
AND msg.sessionid = e.sessionid
AND msg.osuser = e.osuser)
WHEN MATCHED THEN
UPDATE SET msg.callstack = DECODE(msg.callstack
,e.callstack,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:
Jordan,
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”
..Brad
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 msgUSING (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'
AND s.TYPE <> 'BACKGROUND'
AND s.audsid = (SELECT USERENV('SESSIONID')
FROM dual)) e
ON (msg.message = SUBSTR(ai_strMessage
,INSTR(ai_strMessage,msg.message)
,LENGTH(ai_strMessage))
AND msg.messagedate BETWEEN (e.messagedate - (10/86400)) AND e.messagedate
AND msg.sessionid = e.sessionid
AND msg.osuser = e.osuser)
WHEN MATCHED THEN
UPDATE SET msg.callstack = DECODE(msg.callstack
,e.callstack,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
Jordan,
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”
..Brad
Comments
Post a Comment