here inputStr (varchar) is the input string, inputStrLen(int) is the length of the input string and padStr (varchar) is the string which will be used to pad if input string is empty. All these are defined as parameters
outStr (varchar) is defined as a local variable.
I get an error for the first line which says.
[Function:CF_SubstEmptyField]
The function <CF_SubstEmptyField> contains an invalid expression. Additional information: <The second parameter of the function must be an integer constant.>. (BODI-1111182)
The inputStrLen is defined as int. So whats wrong here :?
Ahhh, that. Imagine the mapping of a varchar(3) is
lpad(‘9’, $x, ‘0’)
Should that raise a validation error, yes or no? It depends, if $x <=3 then the lpad returns a string of length(3) or less and all is in other, otherwise if $x=100, you will lose data assigning it to a varchar(3).
As a result, development decided that the length portion of the lpad cannot be a variable.