2012-07-22 15:59:26 +02:00
|
|
|
<h3>CASE expression</h3>
|
|
|
|
A conditional expression that can be used to evaluate multiple expressions and
|
2012-07-22 00:28:39 +10:00
|
|
|
return a result.
|
|
|
|
|
|
|
|
<h4>Syntax</h4>
|
|
|
|
<pre>
|
|
|
|
CASE
|
2012-07-22 15:59:26 +02:00
|
|
|
WHEN <i>condition</i> THEN <i>result</i>
|
2012-07-22 00:28:39 +10:00
|
|
|
[ ...n ]
|
2012-07-22 15:59:26 +02:00
|
|
|
[ ELSE <i>result</i> ]
|
2012-07-22 00:28:39 +10:00
|
|
|
END
|
|
|
|
</pre>
|
2012-07-22 15:59:26 +02:00
|
|
|
[ ] marks optional components
|
2012-07-22 00:28:39 +10:00
|
|
|
|
|
|
|
<h4>Arguments</h4>
|
|
|
|
<!-- List args for functions here-->
|
2012-07-22 15:59:26 +02:00
|
|
|
<i> WHEN condition</i> - The condition expression to evaluate. <br>
|
|
|
|
<i> THEN result</i> - If <i>condition</i> evaluates to True then <i>result</i> is evaluated and returned. <br>
|
|
|
|
<i> ELSE result</i> - If none of the above conditions evaluated to True then <i>result</i> is evaluated and returned. <br>
|
2012-07-22 00:28:39 +10:00
|
|
|
|
|
|
|
<h4>Example</h4>
|
|
|
|
<!-- Show example of function.-->
|
|
|
|
<pre>
|
|
|
|
CASE
|
|
|
|
WHEN <i>"column" IS NULL</i> THEN <i>'None'</i>
|
|
|
|
ELSE <i>"column"</i>
|
|
|
|
END
|
|
|
|
</pre>
|