SQL Statements and Extensions for the Salesforce Driver : SQL Expressions : Functions

Functions
The Salesforce driver supports a number of functions that you can use in expressions, as listed and described in the following tables.
Returns the current date and time as a timestamp, use CURRENT_TIMESTAMP instead.
IFNULL(expr,value)
If expr is NULL, then value is returned; otherwise the result of expr is returned. See COALESCE for evaluating multiple expressions.
CONVERT(term,type)
Converts term to another data type.
CAST(term AS type)
Converts term to another data type.
COALESCE(expr1, expr2, ...)
If expr1 is not Null, then it is returned; otherwise, expr2 is evaluated and, if not Null, it is returned, and so on. This is an ANSISQL standard system function.
NULLIF(value1,value2)
If value1 equals value2, then Null is returned; otherwise, value1 is returned.
CASE value1 WHEN value2 THEN value3 [ELSE value4] END
When value1 equals value2, then value3 is returned; otherwise, value4 or Null is returned in the absence of ELSE.
CASE WHEN expr1 THEN value1 [WHEN expr2 THEN value2] [ELSE value4] END
When expr1 is true, then value1 is returned (optionally repeated for more cases); otherwise value4 or Null is returned in the absence of ELSE.
POSITION(string_expression1 IN string_expression2)
If string_expression1 is a sub-string of string_expression2, then the position of the sub-string, counting from one, is returned; otherwise, 0 is returned.
SUBSTRING(string_expression FROM numeric_expression1 [FOR numeric_expression2])
string_expression is returned from the numeric_expression1 starting location. Optionally, numeric_expression2 specifies the length of the substring.

© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.