A Case for CASE
March 10, 2010 Skip Marchesani
The CASE operation is common to several programming languages on the IBM i. This includes SQL in DB2 for i, where it is available as the CASE statement for use in conjunction with a SELECT statement, or CASE expression for use in conjunction with the DB2 for i SQL Procedure Language. If you aren’t familiar with CASE from an SQL perspective, it’s a really effective mechanism to easily handle one or more forms of simple or complex conditional processing within the same SQL statement. The Two Forms of CASE There are two forms of CASE: Simple WHEN clause and searched |