Search code examples
mysqlsqlsyntaxmysql-error-1292

Error Code: 1292. Truncated incorrect DOUBLE value


I am trying to insert data, by the query:

insert into email (emailAddress, isPreferredEmail, customer_id, upload_id)
select cast(Email as char(100)) a,
       TRUE,
       (select id from customer c where c.dbvehregno=ChassisNo),
       uploadid
  from hyundaiindividualreport
 where id in (select max(id) 
                from hyundaiindividualreport 
               where length(Email>=5) 
                 and uploadid=900 
               group by ChassisNo);

But it's throwing:

  Error Code: 1292. Truncated incorrect DOUBLE value

Email Table structure:

 Table: email
Columns:
email_Id bigint(20) AI PK, 
emailAddress varchar(300) ,
isPreferredEmail bit(1) ,
updatedBy varchar(255) ,
customer_id bigint(20) ,
upload_id varchar(255)

Solution

  • This expression does not look right:

    length(Email >= 5)
    

    I think you mean:

    length(Email) >= 5
    

    However, it seems surprising that it would generate that particular error in MySQL.