Ok, I did not even notice that SUBSTR & SUBSTRING were behaving differently.
I am new to the Teradata DB and I inherited this piece of code, I clearly did not challenged enough the existing code. Anyway, the solution CHAR(${SPC_NB}) is also raising the error.
I tried the others and the one that works is
SUBSTRING(CAST('' AS CHAR(${MAX_SPC_NB})) FROM 1 FOR ${SPC_NB} )
Thanks for pointing me to the right direction, really appreciated.
Ok, I did not even notice that SUBSTR & SUBSTRING were behaving differently.
I am new to the Teradata DB and I inherited this piece of code, I clearly did not challenged enough the existing code. Anyway, the solution CHAR(${SPC_NB}) is also raising the error.
I tried the others and the one that works is
SUBSTRING(CAST('' AS CHAR(${MAX_SPC_NB})) FROM 1 FOR ${SPC_NB} )
Thanks for pointing me to the right direction, really appreciated.