SQL Error [1292] "Truncated incorrect INTEGER value" - with Varchar columns and CASE. Why?
Seems like a bug in mysql5.7 - it works both in mysql5.6 and mysql8.0.
I have no idea why it can be like that, but I was able to reproduce that with simpler insert statement:
insert into TGT(C)
select
    CASE
        WHEN if(Z in ('XYZ'), A, NULL) IS NULL THEN NULL
    END AS C
from SRC;

Seems like some implicit conversion makde by mysql. Forcing explicitly convert helps:
insert into TGT(C)
select
    CASE
        WHEN if(Z in ('XYZ'), convert(A, char(63)), NULL) IS NULL THEN NULL
    END AS C
from SRC;

(but converting whole case..end does not.