2016-06-01 1 views
2

とSQLコマンド正常に終了しないエラー私はjdbc.Iで働いていますが、私は次のエラーを取得していたPreparedStatementます。java.sql.SQLException:ORA-00933:LIKE SQLクエリ

PreparedStatement pstmt=con.prepareStatement("select * from customer where INITIALIZED=1 && FILE_NAME LIKE ?"); 
    //filename is string 
    pstmt.setString(1, "%" + filename + "%"); 
    rs=pstmt.executeQuery(); 

以下で例外を取得しています

016-06-01 18:59:55 ERROR DatabaseUtils:276 - java.sql.SQLException: ORA-00933: SQL command not properly ended 

Exception in thread "main" java.lang.NullPointerException 
at pe.entel.DatabaseInsertionandRetrieving.LocalDatabaseTransactImpl.retrievewithfilename(LocalDatabaseTransactImpl.java:279) 
at pe.entel.DatabaseInsertionandRetrieving.LocalDatabaseTransactImpl.main(LocalDatabaseTransactImpl.java:287) 

答えて

2

問題は、クエリに構文エラーがあることです。

// Introduced sql only for a better reading 
String sql = "select * from customer where INITIALIZED=1 AND FILE_NAME LIKE ?"; 
PreparedStatement pstmt = con.prepareStatement(sql); 
:あなたは次のように、 ANDなく &&を使用する必要があるSQLで