I have a parametrized SQL query that I want to execute from (local) R on Exasol database as described here: https://db.rstudio.com/best-practices/run-queries-safely/#parameterized-queries.
with tab as
(select
t.*,
position(value in ?) as pos
from MY_TABLE t
)
select * from tab where pos > 0;
The value that is passed to ?
is a (long) string. When this string is 2000 characters long or less, everything works fine. When I increase it to 2001 characters, I get an error:
Error in result_bind(res@ptr, as.list(params)) :
nanodbc/nanodbc.cpp:1587: 40001: [EXASOL][EXASolution driver]GlobalTransactionRollback
msg: data exception - string data, right truncation. (Session: 1640027176042911503)
I guess the source of the problem is that my parameter is recognized as CHAR
and not as VARCHAR
.
The Exasol User Manual states:
"The length of both types is limited to 2,000 characters (CHAR) and 2,000,000 characters (VARCHAR), respectively".
Is there any way to cast ?
to VARCHAR
?