Skip to Content
0
Former Member
Apr 22, 2005 at 10:06 AM

Open SQL/JDBC - String compare in where clause

32 Views

Hi,

I have the next code:

-


PreparedStatement stmt = con.prepareStatement(

"select ANUMMER, GESLACHTSNAAM from XAP_SAP_PERSOON where GESLACHTSNAAM = ?");

try {

stmt.setString(1, geslachtsnaam);

ResultSet rs = stmt.executeQuery();

-


This code gives a error:

-


Exception caught com.sap.sql.log.OpenSQLException: The SQL statement "SELECT "ANUMMER","GESLACHTSNAAM" FROM "XAP_SAP_PERSOON" WHERE "GESLACHTSNAAM" = ?" contains the semantics error[s]: type check error: the expression >>"GESLACHTSNAAM"<< (CLOB) is not comparable and must not be used with "=" at

-


But when I do the same for the value ANUMMER, which is a long type, and a set the value with setLong function, everything works fine.

So the code is ok, so why is it then not possible to compare a string in the where clause.

Hopefully someone can help!

Thanks in advance!