Java上的ORA-00932错误

时间:2017-12-06 10:47:14

标签: ora-00932

我有一个结论Dao.java类来运行sql查询

它有

private String getCriteria(GsSrvyRepConclusion Conclusion, boolean isUpdateStatement) {
        String criteriaStatement = "";
if(Conclusion.getRecommendation() != null){
            statement += getConnectorStatement(criteriaStatement, isUpdateStatement) " CONCLUSION.recommendation =:recommendation";
        }

recomandation被定义为数据库中的CLOB数据类型。我只知道CLOB数据类型不能与" ="登录查询。

但当我用""替换等号时,ORA-00932错误变为ORA-00927,这是缺少eqaul符号错误。

你能告诉我这个问题吗?问题可以通过使用三元运算符来解决,但我无法解决。

声明已经定义。我只需要改变;

CONCLUSION.recommendation =:recommendation

1 个答案:

答案 0 :(得分:0)

if(Conclusion.getRecommendation() != null){
            statement += getConnectorStatement(criteriaStatement, isUpdateStatement) " CONCLUSION.recommendation =:recommendation";
        }

应该写成

 if(Conclusion.getRecommendation() != null){
            statement += getConnectorStatement(criteriaStatement, isUpdateStatement) + ((isUpdateStatement) ? " CONCLUSION.recommendation =:recommendation " : " CONCLUSION.recommendation like :recommendation ");
        }