Problem with EXECUTE ... USING ... and same variable used twice or more (Teradata 13.10, 14.00)

Database
N/A

Problem with EXECUTE ... USING ... and same variable used twice or more (Teradata 13.10, 14.00)

There is a bug in older Teradata databases

When you are using same variable for different parameter markers Teradata throws an error:

[Teradata][ODBC Teradata Driver][Teradata Database] PROCEDURE:There is a mismatch between the number of parameters specified and the number of parameters required

for example:

set v_sql = 'UPDATE table SET column3 = ''abc'' WHERE column1 = ? and column2 = ?';

PREPARE s_sql FROM v_sql;

EXECUTE s_sql USING variable1, variable1;

There is of course a very simple workaround:

set variable1_copy = variable1;

...

EXECUTE sql USING variable1, variable1_copy;

but when you use same variable more than twice, it doesn't look good.

It occurs on versions: 13.10.00.05 and 14.00.03.02.

It doesn't occur on 14.10.00.02.

Is there a patch for 13.10 and 14.00 fixing the problem?