Pergunta

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?

Foi útil?

Solução

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 and VARCHAR data types, instead of their LONG counterparts, whenever possible. The VARBINARY and VARCHAR 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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a dba.stackexchange
scroll top