check_null_str

/*

    if <value> is an integer returns 'Y'
    elif upper <value> = 'NULL' return NULL
    else 'Y'
*/

{% macro check_null_str(column_name) %}
    case
        when {{ column_name }} is null then null
        when UPPER({{ column_name }}) = 'NULL' then null
        else {{ column_name }}  
    end
{% endmacro %}