ORDER BY
Alternatively, if you are ordering by the data-sorting key, you can use the ORDER YES option (ORDER). ORDER BY overrides ORDER YES.
Restriction
UNLOAD PLUS terminates when either of the following conditions exists:
- You specify a LOB or XML column on the ORDER BY option.
- You specify SPANNED YES.
Additional considerations
Note the following considerations when using the ORDER BY option:
- The encoding scheme of the table determines the collating sequence for character data. For example, if the table is in EBCDIC, the collating sequence is EBCDIC.
- ORDER BY sets MAXSORTS to 1 and assigns all partitions to a single task when any of the following conditions exists:
- The columns that you specify in the ORDER BY option are different from the partitioning key columns.
- The columns that you specify in the ORDER BY option are the same or a subset of the partitioning index key columns but are in a different order.
- You are unloading a partition-by-growth table space.
- Ensure that UNLOAD PLUS has adequate sort work space for sorting data in all partitions. For information about sizing sort work data sets, see SORTWK-data-sets.
- When you specify ORDER BY and INTO, UNLOAD PLUS uses the data type of the column that is defined in the DB2 table to sort the data. UNLOAD PLUS does not sort on the data type that you specify in the INTO statement.
columnName
Identifies a column of the specified table that you want to use for ordering.
ASC | ASC is the default, and specifies that UNLOAD PLUS uses the values of the column in ascending order. |
---|---|
DESC | DESC specifies that UNLOAD PLUS uses the values of the column in descending order. |
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*