oci_bind_by_name - 并非所有变量都绑定错误
我想在这样的查询中绑定变量:
SELECT people.name, conf.id
FROM people, conf
WHERE people.confid=conf.id AND people.name LIKE :c1 AND conf.name LIKE :c2
绑定(我尝试使用一个非常简单的表达式):
$tmp = '%';
$tmp2= '%';
oci_bind_by_name($statement, ':c1', $tmp);
oci_bind_by_name($statement, ':c2', $tmp2);
警告:oci_execute()[function.oci-execute]:ORA-01008:并非所有变量都绑定在.. ..php 第 162 行
如果我使用 {$tmp} 而不是 :c1 即时生成查询,它就可以工作。
有什么想法吗?
谢谢!
I want to bind the variables in a query like this:
SELECT people.name, conf.id
FROM people, conf
WHERE people.confid=conf.id AND people.name LIKE :c1 AND conf.name LIKE :c2
The binding (I try to use a very simple expression):
$tmp = '%';
$tmp2= '%';
oci_bind_by_name($statement, ':c1', $tmp);
oci_bind_by_name($statement, ':c2', $tmp2);
The Warning: oci_execute() [function.oci-execute]: ORA-01008: not all variables bound in ....php on line 162
If I generate the query on the fly, with: {$tmp} instead of :c1, it works.
Any ideas?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了问题:
我没有调用 oci_free_statement() 方法。这有点奇怪,因为在同一数据库连接中的其他页面上,绑定工作正常,没有调用免费方法......
I solved the problem:
I didn't call the oci_free_statement() method. That's a little weird, because on my other page in the same database connection, the binding worked fine, without calling the free method...