Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert BLOB to varchar with SAP HANA database using SQL

Tags:

varchar

blob

hana

how do I cast a blob to varchar with SAP HANA database using SQL.

(we need the column to be stored in blob - not TEXT - in else HANA automatically creates an index on this column. But we need an index with full-text-search and CORE_EXTRACTION)

The following code

select 
cast("DESCRIPTION" as varchar) "D"
from "DESC"

returns

Could not execute 'select cast("DESCRIPTION" as varchar) "D" from "DESC"' in 30 ms 168 µs .

SAP DBTech JDBC: [266]: inconsistent datatype:

like image 405
Thorsten Niehues Avatar asked Sep 18 '25 00:09

Thorsten Niehues


1 Answers

Solved the problem with this select statement

select cast(BINTOSTR(cast(description as binary)) as varchar) from xing_desc
like image 177
Thorsten Niehues Avatar answered Sep 19 '25 22:09

Thorsten Niehues