cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle JDBC - Need help using Binary fields in WHERE clause

brian_arthern2
Participant
0 Kudos

Hi,

I am trying to read some data from the XI tables in order to retrieve information about open changelists.

The VERSIONSETID field which forms the key for the table is of type BINARY (or RAW - depending on what tool you use to view the definition).

When I execute the SQL statement below using AquaStudio, it works perfectly:

select a.OWNERNAME, b.SHORTTEXT

from XI_QCHANGELIST a, XI_QVERSIONSET b

where a.VERSIONSETID = HEXTORAW('9b1f867001e411dfb7a300144fac60d4')

and a.VERSIONSETID = b.VERSIONSETID

When I attempt to execute the statement via JDBC in a servlet I get the following SQLException:

com.sap.sql.log.OpenSQLException: The SQL statement "select a.OWNERNAME, b.SHORTTEXT from XI_QCHANGELIST a, XI_QVERSIONSET b where a.VERSIONSETID = HEXTORAW('9b1f867001e411dfb7a300144fac60d4') and a.VERSIONSETID = b.VERSIONSETID" contains the syntax error[s]: SQL syntax error: the token "(" was not expected here at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:106) at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:145)

So it does not appears to like the hextoraw() function.

I have tried using just the GUID value in quotes but then the exception thrown complains about incompatible types (binary and char)

Can someone please explain how I can use binary data as part of a select statement in the openSQL jdbc driver that SAP provides?

thanks in advance,

Brian

Accepted Solutions (0)

Answers (1)

Answers (1)

brian_arthern2
Participant
0 Kudos

Never mind, I solved it.