tencent cloud

Feedback

Condition Functions

Last updated: 2023-11-08 14:19:01
Conditional functions are described as follows:
Function
Description
CASE valueWHEN value1 [, value11 ] THEN result1[ WHEN valueN [, valueN1 ] THEN resultN ]* [ ELSE resultZ ] END
Returns result1 when the value is contained in the range of value1 to value11.
Returns resultN when the value is contained in the range of valueN to valueN1.
Returns resultZ when no value matches.
CASEWHEN condition1 THEN result1[ WHEN conditionN THEN resultN ] * [ ELSE resultZ ] END
Returns result1 when condition1 is met.
Returns resultN when conditionN is met.
Returns resultZ when no condition is met.
NULLIF(value1, value2)
Returns NULL if value1 is equal to value2; returns value1 otherwise. For example, NULLIF(5, 5) returns NULL, and NULLIF(5, 0) returns 5.
COALESCE(value, value [, value ]* )
Returns the first parameter that is not NULL. For example, COALESCE(NULL, 5) returns 5.
IF(condition, true_value, false_value)
Returns the true_value if condition is met, otherwise the false_value. For example, IF(2 > 1, 2, 1) returns 2, and IF (1 > 2, 99, 100) returns 100.
IS_ALPHA(string)
Checks whether string contains only letters. Returns true if so, otherwise false.
IS_DECIMAL(string)
Checks whether string is a valid number (integer, decimal, or negative number). Returns true if so, otherwise false.
IS_DIGIT(string)
Checks whether string contains only digits (i.e., an unsigned integer). Returns true if so, otherwise false.
IF_NULL_STR(str, defaultValue)
Returns the value of str itself if it is not NULL; otherwise, returns the value of defaultValue.

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support