The IFMISSING function writes out a specified value if the source value is a null or missing value. Otherwise, it writes the source value. Input can be a literal, a column reference, or a function.

Tip: Since this function captures both missing and null values, you may first wish to address the rows with null values using the IFNULL or ISNULL functions. Any remaining rows that are matched based on this function are exclusively missing values.

ifmissing(my_score,'0')

Output: Generates a new column called, final_score, which contains the value 0 if the value in my_score is a null or missing value. 

ifmissing(column_string, computed_value)


ArgumentRequired?Data TypeDescription
source_valueYstringName of column, string literal or function to be tested
output_valueystringString literal value to write

source_value

Name of the column, string literal, or function to be tested for missing values.

Required?Data TypeExample Value
YesString literal, column reference, or functionmyColumn

output_value

The output value to write if the tested value returns a null or missing value.

Required?Data TypeExample Value
YesString or numeric literal'Missing input'

Example - IF* functions for data type validation