provides a simple if-else alternative to the SQL CASE statement


object viv_if_else(cond, expression1, expression2);
string cond;
string expression1;
string expression2;


The viv_if_else function evaluates the Boolean test condition passed as cond, returning expression1 if cond is true and returning expression2 if cond is not true.

This function provides a simple if-else statement. This can simplify any SQL code that you write by using viv_if_else instead of the standard SQL CASE construct.


  • cond: test condition
  • expression1: values to return if the condition is true.
  • expression2: values to return if the condition is false.


  • expression1 if cond is verified
  • expression2 if not.
Note: This function is only available when using SQLite with Watson™ Explorer Engine.