cancel
Showing results for 
Search instead for 
Did you mean: 

Open SQL/JDBC - String compare in where clause

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I found out that you have to set the length of the string field in de dictonary on 1000 or less.

Former Member
0 Kudos

Thats right because otherwise your DB column "GESLACHTSNAAM" is defined as CLOB and not as VARCHAR2 in your DB. A CLOB is a not comparable Datatype in SQL.