-171   THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT argument-position OF function-name IS INVALID

Explanation

The data type, the length, or the value of an argument of a scalar function is incorrect.

argument-position
An integer that identifies the position of the incorrect argument in the function invocation.
function-name
The name of the scalar function.

System action

The statement that contains the function cannot be processed.

Programmer response

Correct the invocation of the function, and reissue the statement.

Problem determination

If the encoding scheme is EBCDIC or ASCII, a possible reason for this error is that a character argument was specified for a built-in function that expects a graphic argument, or a graphic argument was specified for a built-in function that expects a character argument. The UNICODE encoding scheme supports the mixing of character and graphic arguments, but EBCDIC and ASCII do not.

If the function is a string function, this code might be issued if a string unit was required but not specified. The string unit keywords are CODEUNITS16, CODEUNITS32, and OCTETS.

Start of changeIf a default is defined for a parameter of the function, the value of the argument-position token for SQLCODE -171 might take into consideration the implicit argument.End of change

Start of changeFor example, suppose that you invoke this function, in which parameter value '12' is invalid:End of change

Start of change
TRIM('12' FROM '123')
End of change

Start of changeThe first argument, BOTH, is implicitly specified. Therefore, the value of argument-position for parameter value '12' is 2.End of change

SQLSTATE

22546 if the error is encountered for an invalid format for a BSON object; 42815 otherwise.