ora-00932

ORA-00932 error on Java


I have a conclusionDao.java class to run sql queries

It has

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

recomandation is defined as CLOB data type in the database. I just know that CLOB data type cannot be used with "=" sign on the query.

But when I replace equal sign with "like", ORA-00932 error turns to ORA-00927 which is missing eqaul sign error.

Can you give me an idea about the problem? The problem can be solved by using ternary operator but I couldn't solve.

Statement's already been defined. I only need to change;

CONCLUSION.recommendation =:recommendation

Solution

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

    should be written as

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