MySQL procedure Insert error “Column count doesn't match value count at row 1”


Recently I have came across a strange situation in MySQL Database. I have created a MySQL procedure that uses insert statement to insert values in database table. However, It was working fine previously but all of a sudden it stopped working with below error code-

Problem
Error Code: 1136. Column count doesn't match value count at row 1

Normally this error indicates my insert columns have a mismatch values i.e. consider a insert statement as shown below-
insert into table1(col1,col2,col3,col4,col5) values(val1,val2,val4,val5)

We can clearly see that col3 has a missing value in above statement i.e. mismatch of columns and corresponding values. However this was not a case with mine. Every column has corresponding value but still same error.

Cause
Upon close observation of other DB objects, I saw that there was a trigger associated with the table that has missing attributes and hence the same was causing error while inserting values in this table

Solution
Necessary correction done in trigger / deleted partially created trigger and saved it. Now Insert was working fine as expected.

Comments

  1. Thank you for your valuable content , Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database. Zero Cost Cloud Migration services

    ReplyDelete
  2. Really very informative and the way you present your information attracts visitors to read a more informative blog from your website. So I look forward to seeing the next update.I hope you continue to have such good posts click here Product Engineering Services | Product Engineering Solutions.

    ReplyDelete

Post a Comment

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c