1. A computer-implemented method for executing a query in a computer to retrieve data from a relational database stored on a data storage device, the method comprising: receiving a query containing a CASE expression having one or more subqueries; generating a query execution plan, the query execution plan using a parameterized union all operator to keep the semantics of the CASE expression, and a nested loop join operator to drive data across the section of the query execution plan that executes the CASE expression without performing any join operations; and executing the generated query execution plan in the computer to retrieve data from the relational database.