Start of change

-20305   AN XML VALUE CANNOT BE INSERTED OR UPDATED BECAUSE OF AN ERROR DETECTED WHEN INSERTING OR UPDATING THE INDEX IDENTIFIED BY index-id ON TABLE table-name. REASON CODE = reason-code

Explanation

The insertion or update of an XML value failed during insertion or update of the specified index. The statement cannot proceed, and the table and index remain unchanged.

index-id
The index ID.
table-name
The name of the table.
reason-code
The reason for the message or SQL code, indicated by one of the following values:
1
One or more XML node values in an XML value being inserted or updated exceeds a length constraint imposed by the identified index. The index on an XML column is defined to use the SQL type VARCHAR with a specific length specified. The length of one or more XMLPATTERN result values exceeds the user-specified length constraint for the VARCHAR data type.
4
At least one XML node value is a valid XML value that cannot be cast to the index data type for the identified index. That value is outside the supported range of values.
6
One or more XML node values are XML values, but those XML values span multiple records. DB2® cannot create an index key on an XML value that spans multiple records.

System action

The statement cannot be processed.

Programmer response

Use the following query to determine the table name and index ID:

SELECT NAME as IndexName,
       TBNAME as TableName
FROM SYSIBM.SYSINDEXES
WHERE index-id;

Take the action indicated by the reason code:

1
Use the XML pattern information to identify the set of matching XML nodes to inspect to determine which string values are beyond the limit of the length constraint specified by the index.
4
Use the XML pattern information to identify the set of matching XML nodes to inspect and compare against the data type specified for the identified index. Determine which node values exceed the range of values supported by DB2 for the index data type.
6
Use the XML pattern information to identify the set of matching XML nodes to inspect to determine which values might be spanning multiple records. Generally, large values might lead to multiple records. Large values might arise from a single large text node, or an element node with many descendant text nodes.

SQLSTATE

23525

End of change