I need to execute a query
where the value to be concatenated should be passed as a parameter to the query.
SELECT t.id || @p || t.nome FROM Test t;
But when you run this query it returns the following error: Dynamic SQL Error.
In MySQL, this idea works as follows:
SELECT CONCAT(t.id, @p, t.nome) FROM Test t;
I wonder if there is any way to do this type of concatenation in Firebird? For what I noticed the ||
operator is what causes this problem when a parameter is used.
Obs1: The value to be concatenated as a separator must be passed by parameter.
Obs2: I know that if I do the concatenation of the value in the query this works, getting the query to be executed this way:
select t.id || 'stringparaseparar' || t.nome from Test t;
, but in my case as mentioned above it is necessary that this value be passed by parameter. Ex: set @p = 'stringparaseparar'.
To better clarify the reason for this need, please follow this other question that describes the source of this problem.