cancel
Showing results for 
Search instead for 
Did you mean: 

how to select and compare long data from maxdb

Former Member
0 Kudos

I have sap and java db. I try select data from table with this request

sql_execute SELECT * FROM SAPPOPDB.T_CHUNK where T_CHUNK.CHUNK_DATA < '10000'

but got this response


-24988,ERR_SQL: SQL error

-7032,SQL statement not allowed for column of data type LOB

db structure


DOMAIN_HASH KEY NUMBER  10  0  SEL+UPD+   0   1   1   25.04.2014  17:31:17   25.04.2014  17:31:17

DOMAIN_COUNTER  KEY NUMBER  10  0  SEL+UPD+   0   2   2   25.04.2014  17:31:17   25.04.2014  17:31:17

SESSION_HASH  KEY NUMBER  10  0  SEL+UPD+   0   3   3   25.04.2014  17:31:17   25.04.2014  17:31:17

SESSION_COUNTER KEY NUMBER  10  0  SEL+UPD+   0   4   4   25.04.2014  17:31:17   25.04.2014  17:31:17

CHUNK_NAME  KEY VARCHAR UNICODE 200  SEL+UPD+   5   5   25.04.2014  17:31:17   25.04.2014  17:31:17

CHUNK_DATA OPT LONG BYTE SEL+UPD+   6   25.04.2014  17:31:17   25.04.2014  17:31:17

please help how I can get CHUNK_DATA from table?

DB - MaxDB Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

thorsten_zielke
Contributor
0 Kudos

Hi,

you cannot compare the content of CHUCK_DATA directly, because the datatype is 'long'.
But as a workaround, you can convert the content to a string and then work with that string e.g.:

...where substr(T_CHUNK:CHUNK_DATA,1,5) < '10000'

with (1,5) means building a string starting with the first character and a string length of 5 characters.

Hope that helps,
Thorsten

Former Member
0 Kudos

Exception of type com.sap.sql.log.OpenSQLException caught: The SQL statement " DELETE FROM BC_UDV3_ROLES WHERE PERMISSION_ID = 'x' AND 0=(SELECT count(*)  FROM  SAPPOPDB.T_CHUNK, SAPPOPDB.J2EE_CONFIGENTRY  WHERE  substr(T_CHUNK.CHUNK_DATA,1,5) < '1000' AND '1'='1')AND '1'='1'" contains the syntax error[s]: - 1:142 - SQL syntax error: the token "(" was not expected here

.#

thorsten_zielke
Contributor
0 Kudos

Hmm, can you try the SQL via a tool like Database Studio or SQL Studio? I would expect that the SQL statement works fine, because the error "-1:142 - SQL syntax error..." is not a MaxDB database error...