News
Abstract
You can now create and add range partitions in any order in a range-partitioned table with a single key, so Generate SQL no longer fails with SQL0636.
Content
You are in: IBM i Technology Updates > Db2 for i - Technology Updates > Db2 for i Database Engineer (DBE) Enhancements > Ability to create range partitions out of order
Before this enhancement, creating a range-partitioned table with CREATE TABLE required the ranges to be in order. When you added partitions, the new partition was always the last partition. When you used Generate SQL against the table, the CREATE TABLE statement failed with SQL0636 because the ranges were not in order.
This enhancement applies to range partitions with a single key. The CREATE TABLE statement now permits unordered range partitions.
Example: Add a partition and then clone the table
create table corpdb.sales_table(trans_date timestamp)
partition by range(trans_date)
(starting('2013-01-01 00:00:00.000000')
ending ('2013-03-31 23:59:59.999999'),
starting('2013-07-01 00:00:00.000000')
ending ('2013-09-30 23:59:59.999999'));
-- Oops, forgot a partition, add it in
alter table corpdb.sales_table add partition
starting('2013-04-01 00:00:00.000000')
ending ('2013-06-30 23:59:59.999999');
To recreate or clone the table later, you can use the Generate SQL feature in IBM i Access Client Solutions to extract the SQL statements. Because range partitions no longer need to be in order, the SQL0636 error is no longer issued, and the table is created.
Figure 1. The SQL0636 error that is no longer issued

Was this topic helpful?
Document Information
Modified date:
02 December 2026
UID
ibm11168444