Creating table partitions in DB2 for Z/OS

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Creating table partitions in DB2 for Z/OS



Can we create a table which is range partitioned where partition keys are not in order?
For eg.


PARTITION 00001 ENDING AT ('2018-07-02') INCLUSIVE

PARTITION 00002 ENDING AT ('2018-07-03') INCLUSIVE

PARTITION 00003 ENDING AT ('2018-07-08') INCLUSIVE

PARTITION 00004 ENDING AT ('2018-07-05') INCLUSIVE

PARTITION 00005 ENDING AT ('2018-07-20') INCLUSIVE



is this a valid DDL for creating partitioned table in DB2?




1 Answer
1



No, partitions must be "in order". See here for more detail (search for partition-element). I've highlighted the relevant part.


partition-element



The key values are subject to the following rules:



The first value corresponds to the first column of the key, the second value to the second column, and so on. Using fewer values than
there are columns in the key has the same effect as using the highest
or lowest values for the omitted columns, depending on whether they
are ascending or descending.



The highest value of the key in any partition must be lower than the highest value of the key in the next partition for ascending
cases.



The values specified for the last partition are enforced. The value specified for the last partition is the highest value of the key
that can be placed in the table. Any key values greater than the value
specified for the last partition are out of range.



If the concatenation of all the values exceeds 255 bytes, only the first 255 bytes are considered.



If a key includes a ROWID column or a column with a distinct type that is based on a ROWID data type, 17 bytes of the constant that is
specified for the corresponding ROWID column are considered.





Thank you so much!
– Tejasvi Rao
Aug 7 at 8:51






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard