This topic describes how to use the conditional function COALESCE in Realtime Compute.



Input parameters

Parameter Data type
A Any data type
B Any data type
Note All values must be of the same type or be null. Otherwise, an error occurs.


Returns the first non-null value in the specified list. The return value is of the same type as the values of the input parameters. If all values in the list are null, the return value is null.
Note The list must contain at least one parameter. Otherwise, an error occurs.


  • Test data
    var1 (VARCHAR) var2 (VARCHAR)
    null 30
  • Test statements
    SELECT COALESCE(var1,var2) as aa
    FROM T1;     
  • Test results
    aa (VARCHAR)