Unexpected Row Length Errors: Sorting and Default Sort Order
Before performing the sort operation that orders the rows to be returned, Teradata Database creates a sort key and appends it to the rows. If the length of the sort key exceeds the system row length limit of 64 KB, the operation fails and returns an error. Depending on the situation, the error message text is one of the following.
For explanations of these messages, see Messages.
There are several possible reasons why a data row plus BYNET sort key might unexpectedly exceed the spool row size limit of 1 MB, even without including any updates.
See Database Design and SQL Data Types and Literals.
Note that this issue is not relevant if your system uses the packed64 row architecture rather than the aligned row format architecture. For details, see Database Design.
The BYNET only looks at the first 4096 bytes of the sort key created to sort the specified fields, so if the field the sort key is based on is greater than 4096 bytes, the key is truncated and the data may not sort in the desired order.
By default, nulls sort before all other data in a column. In other words, nulls sort low. For example, suppose you want to sort the following set of values: 5, 3, null, 1, 4, and 2.
The values sort as follows:
null
1
2
3
4
5
By default, the result values of a character expression are sorted in ascending order, using the collating sequence in effect for the session.