问题描述
我在用存储过程填充预定义表时遇到一些麻烦.mytable有6个字段:uid,testrun,exp1,exp2,exp3,weightedvalue,其中uid是自动增量PK.我的sp包含一个插入语句,例如:CREATE PROCEDURE test (IN testrun INT)
BEGIN
.... some declare statements ...
INSERT INTO exp_factors(testrun,exp1,exp2,exp3,weightedvalue) VALUES
(testrun,
exp1,
exp2_1 + exp2_2,
exp3_1 + exp3_2,
exp1 * 0,2 + (exp2_1+exp2_2) * 0.5 + (exp3_1+exp3_2) * 0.3);
END
不幸的是,这导致标题中所述的错误.我知道我只插入6个字段中的5个,但是显然我不想手动输入自动增量PK uid.我如何在不传递自动增量ID的情况下将我的exp值输入此表.当然,我可以创建一个没有额外PK的表,但这不是我想要的.
感谢您提出任何建议!
插入的最后一行有一个逗号,由6列代替5列:
exp1 * 0,2 + (exp2_1+exp2_2) * 0.5 + (exp3_1+exp3_2) * 0.3
^
我想这应该是小数点,而不是逗号.
i have some troubles filling a predefined table with a stored procedure.mytable has 6 fields: uid,testrun,exp1,exp2,exp3,weightedvalue where uid is an autoincrement PK. My sp contains an insert statement like:
CREATE PROCEDURE test (IN testrun INT)
BEGIN
.... some declare statements ...
INSERT INTO exp_factors(testrun,exp1,exp2,exp3,weightedvalue) VALUES
(testrun,
exp1,
exp2_1 + exp2_2,
exp3_1 + exp3_2,
exp1 * 0,2 + (exp2_1+exp2_2) * 0.5 + (exp3_1+exp3_2) * 0.3);
END
Unfortunately this results in the error stated in the title. I understand that I insert only 5 of 6 fields but obviously I do not want to enter the autoincrement PK uid manually.How can I enter my exp values to this table without passing on the autoincrement id.Of course I could just create a table without an extra PK, but that´s not what i want.
Thanks for any suggestions in advance!
You have a comma in the last line of your insert, making 6 columns instead of 5:
exp1 * 0,2 + (exp2_1+exp2_2) * 0.5 + (exp3_1+exp3_2) * 0.3
^
I guess that this should be a decimal point, not a comma.
这篇关于错误代码:1136列计数与sp内第1)行的值计数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!