无效的关系运算符 [英] Invalid relational operator

查看:309
本文介绍了无效的关系运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用prepare语句执行更新语句.

I use a prepare statement to execute an update statement.

PreparedStatement stmt = null;
        stmt = connection.prepareStatement("UPDATE " + table + " SET date = ?, id = ?, n = ? " +
                "WHERE (id_v = ?) AND (id_vid = ?)");
        stmt.setDate(1, n.getDate());
        stmt.setInt(2, n.getId());
        stmt.setInt(3, n.getN());
        stmt.setInt(4, n.getId_v());
        stmt.setInt(5, n.getId_vid());
        stmt.executeUpdate();
        stmt.close();

但出现异常j ava.sql.SQLException: ORA-00920: invalid relational operator

我的代码怎么了?

p.s表是我通过方法传递的字符串参数

p.s table is string parametre that I pass through the method

修改 通过使用简单的Statement(而不是PrepareStatement)并通过串联将参数插入到sql UPDATE,解决了该问题.声明表的SQL脚本已由Power Designer从物理数据模型图生成.它创建表字段为"date","id_v","id"等,因此问题不在date字段中.

edit The problem was resolved by using simple Statement(but not PrepareStatement) and inserting parametres to sql UPDATE via concatenation. SQL script of declaring the tables has been generated from physical data model diagram by Power Designer. It creates table fields as "date", "id_v", "id" and so on, so the problem was not in date field.

推荐答案

也许第二个条件应该是AND (id_vid = ?)?

Maybe it should be AND (id_vid = ?) for the second condition?

现在,它说AND (id vid = ?),可能是拼写错误.

Right now, it says AND (id vid = ?) which is probably a typo.

这篇关于无效的关系运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆