0
I’m doing a job with Mysql database and I’m having difficulties in Procedure maid:
DELIMITER $$
drop Procedure if exists cad_cat$$
CREATE PROCEDURE cad_cat(pnomeCat varchar(60))
BEGIN
INSERT INTO Categorias VALUES(pnomeCat);
END$$
DELIMITER ;
I don’t understand this mistake, can anyone explain to me?
call cad_cat('frutas');
Error Code: 1136. Column Count doesn’t match value Count at Row 1
Looks like your table
Categorias
has more than one column and you are trying to enter only one value. The error basically says that it does not match the column quantities of the table with the amount of values you entered.– Woss
It has two id and name fields, but the id I left as auto increment.
– Ronaldo Ávila De Arruda Junior
create table Categories( id_category int Primary key auto_increment not null, name varchar(60) not null)engine=Innodb charset=utf8;
– Ronaldo Ávila De Arruda Junior
Without specifying that you just want to enter the name, you need to specify that the id value will be the default. Or inform that it will only be the column
nome
which will be specified.– Woss
Thanks, I managed to fix the mistake :)
– Ronaldo Ávila De Arruda Junior
Possible duplicate of I cannot enter the values in the table with auto_increment in the primary key
– Woss