Error: The length of ‘{name}’ must be a literal or a host variable; the statement fails when it runs
The optional second argument of %STRING, %SQLSTRING, %SQLUPPER or %TRUNCATE, the
length to truncate to, is a column, a function call or another expression. Only a literal or
a host variable is allowed there. IRIS compiles the class or routine, and the statement gets
SQLCODE -1 when it runs. Pass the length as a literal or a host variable.
IRIS compiles the example.
Class Demo.SqlLengthNotLiteral
{
ClassMethod Upper() As %String
{
&sql(SELECT %SQLUPPER('Ann', 1 + 1) INTO :upper) //! A3473
Quit upper
}
}