Start of change

-20441 type-name TYPE IS NOT VALID WHERE SPECIFIED. REASON CODE reason-code.

Explanation

The identified data type is not valid in the specified context for the reason indicated by the reason code.

type-name
The name of the array type.
reason-code
A numeric value that indicates the reason that the statement cannot be executed. Possible values are:
1
One of the following situations occurred:
  • An array data type was specified in an unsupported context. An array data type can be specified in multiple contexts within SQL PL, including the following contexts:
    • A parameter to a non-inline SQL function
    • A return data type from a non-inline SQL function
    • A parameter to an SQL procedure
    • An SQL variable that is declared in an SQL function
    • An SQL variable that is declared in an SQL procedure
    • A global variable

    Some of the contexts in which an array data type is not supported are:

    • A parameter or variable for an external routine
    • A parameter for an inline SQL function
    • A return type of an inline SQL function
    • A column in a table
    • The SELECT list of the outer fullselect of a scrollable cursor

A value that is not an array value was specified for the UNNEST operator. An array value is the only type of value that is allowed for the UNNEST operator.

2
A global variable was defined as a distinct type. A global variable cannot be defined as a distinct type.
3
An untyped array value was specified in an unsupported context.
4
A non-array value was specified in a context where an array value is expected.
5
An array global variable, or element of an array global variable, was specified in an unsupported context. An array global variable, or element of an array global variable, that is the target of a FETCH statement must be specified only in an SQL PL context. An EXECUTE or OPEN statement that specifies an array global variable or element of an array global variable in the USING clause can only be issued in an SQL PL context.

System action

The statement cannot be processed.

Programmer response

See the documentation for the SQL statement on which the error occurred for a complete list of restrictions on the use of the identified data type. Change the SQL statement to use the data type in a supported context.

SQLSTATE

428H2

End of change