Bookshelf Home | Contents | Index | PDF | ![]() ![]() |
Siebel Analytics Server Administration Guide > SQL Reference > SQL Syntax and Semantics > Conditional ExpressionsThe Expressions folder contains building blocks for creating conditional expressions that use CASE, WHEN, THEN and ELSE statements. CASE (Switch)This form of the Case statement is also referred to as the CASE (Lookup) form. CASE expression1 The value of expression1 is examined, and then the WHEN expressions are examined. If expression1 matches any WHEN expression, it assigns the value in the corresponding THEN expression. If none of the WHEN expressions match, it assigns the default value specified in the ELSE expression. If no ELSE expression is specified, the system will automatically add an ELSE NULL. If expression1 matches an expression in more than one WHEN clause, only the expression following the first match is assigned. NOTE: In a CASE statement, AND has precedence over OR. CASEStarts the CASE statement. Has to be followed by an expression and one or more WHEN and THEN statements, an optional ELSE statement, and the END keyword. WHENSpecifies the condition to be satisfied. THENSpecifies the value to assign if the corresponding WHEN expression is satisfied. ELSESpecifies the value to assign if none of the WHEN conditions are satisfied. If omitted, ELSE NULL is assumed. ENDCASE (If)This form of the CASE statement has the following syntax: CASE This evaluates each WHEN condition and if satisfied, assigns the value in the corresponding THEN expression. If none of the WHEN conditions are satisfied, it assigns the default value specified in the ELSE expression. If no ELSE expression is specified, the system will automatically add an ELSE NULL. NOTE: In a CASE statement, AND has precedence over OR. Unlike the Switch form of the CASE statement, the WHEN statements in the If form allow comparison operators; a WHEN condition of WHEN < 0 THEN 'Under Par' is legal. CASEStarts the CASE statement. Has to be followed by one or more WHEN and THEN statements, an optional ELSE statement, and the END keyword. WHENSpecifies the condition to be satisfied. THENSpecifies the value to assign if the corresponding WHEN expression is satisfied. ELSESpecifies the value to assign if none of the WHEN conditions are satisfied. If omitted, ELSE NULL is assumed. END |
![]() |
![]() ![]() |
Siebel Analytics Server Administration Guide |