问题描述
好吧,我要为此疯狂. MySQL恰恰适合这种SQL:
Ok, I'm going crazy on this one. MySQL is throwing a fit about this bit of SQL:
INSERT INTO `test_table`
( `column1`, `column2` )
VALUES
( ?COURSEID, ?COURSENAME )
您的SQL语法有错误;在第1行的"COURSENAME)"附近检查与MySQL服务器版本相对应的手册以使用正确的语法
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COURSENAME )' at line 1
我的调试代码显示了两个已填充的参数值.
My debug code is showing both of the parameter values filled.
推荐答案
MySQL不支持命名参数占位符.您可以仅使用 位置参数占位符.也就是说,占位符只是一个?
符号.
MySQL does not support named parameter placeholders. You can use only positional parameter placeholders. That is, a placeholder is just a ?
symbol.
顺便说一下,这符合ANSI SQL的行为.像Oracle这样的RDBMS支持命名参数作为标准的扩展.
This conforms to the ANSI SQL behavior, by the way. RDBMS like Oracle support named parameters as an extension to the standard.
这篇关于MySQL拒绝参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!