[thelist] Owed tip - SQL Decode as a quick fix for data quality

Luther, Ron Ron.Luther at hp.com
Wed Oct 5 16:41:11 CDT 2005


Ken Schaefer asked:

>>It may be helpful if you mention which DBMS this applies to.


Hi Ken, 

Sorry. I realized that about an hour after I sent it.  The tip was
intended for Oracle syntax.  However, IIRC, isn't "decode(column_name,
value_1, revised_value_1, value_2, revised_value_2, ..., default)"
fairly common and, in fact, the same syntax in MS-SS T-SQL as it is in
Oracle PL/SQL?


>>I disagree with the use of the "dummy values" as well. Generally 
>>you'd throw an exception when the data is entered -or- use a NULL 
>>(or similar).

;-)  _Generally_ ... I agree with you. 'Dummy values' are often
overused. 

In this case, however, the issue is political: I have a couple of
examples here where I have apps that have been running for over a
decade, (and an ingrained corporate culture that probably extends yet
further back in time), where *everyone* from The Board on down has
'agreed to' this use of this particular default 'dummy value' or two.
These are cases where you can say "Oh, that's a [half of the dummy
value] order." in a meeting with mixed levels of management - and
everyone would know exactly what you were talking about. It's that
ingrained.

I'm not gonna win that fight, Ken.  I'm not even going to try.  I'm
going to continue to use those 'dummy values'.

We can quibble about exception processing another day!  ;-)


Peace Out,

RonL.


More information about the thelist mailing list