Domanda
I had DB Vertica 8.0. Create schema WAREHOUSE with table include field by type LONG VARCHAR. Now I tried to execude SELECT for example
SELECT * FROM WAREHOUSE.ALL_EVENTS a
WHERE
a.original_data like '%d963%'
returned error
SQL Error [4286] [42883]: [Vertica][VJDBC](4286) ERROR: Operator does not exist: long varchar ~~ unknown
[Vertica][VJDBC](4286) ERROR: Operator does not exist: long varchar ~~ unknown
com.vertica.util.ServerException: [Vertica][VJDBC](4286) ERROR: Operator does not exist: long varchar ~~ unknown
In Oracle I used dbms_lob package for CLOB fields.
Vertica have simular package for LONG VARCHAR types?
How "LIKE" by LONG VARCHAR?
Soluzione
Vertica documentation about LONG
datatypes, in either version 7.1 or 8.0 states:
Notes
For optimal performance of
LONG
data types, HP Vertica recommends that you:
- Use the
LONG
data types as storage only containers; HP Vertica does not support operations on their content.- Use the
VARBINARY
andVARCHAR
data types, instead of theirLONG
counterparts, whenever possible. TheVARBINARY
andVARCHAR
data types are more flexible and have a wider range of operations.
VARCHAR
datatype supports up to 65K bytes long strings. You could use that instead, if the data are not longer.
Altri suggerimenti
You can use REGEXP_LIKE
instead of LIKE
. Refer to the Reference Page and this Stackoverflow answer of similar question. However you may not use %
or _
simple wildcard which supported by LIKE
operator. In order to find more complex case, you should know about Regular Expressions.