Db2

Db2

Where DBAs and data experts come together to stop operating and start innovating. Connect, share, and shape the AI era with us.


#Data


#Data
 View Only
  • 1.  table partition

    Posted Thu February 16, 2023 10:16 AM

    Lets say I created a table with the following DDL, where I specify a starting date (2020-01-01) and end date(2022-12-31) of the partition.

    I would like to know what happen if I insert a record where the date is not within the partition start/end date? eg, I insert a record with the date 1990-01-01, or 2050-12-12?


    CREATE TABLE "ANALYTICS01" (

    "ID" INTEGER NOT NULL,

    "ORIGIN_STATE" VARCHAR(100) NOT NULL,

    "ORIGIN_DATE" DATE NOT NULL

    PRIMARY KEY (ID))

    ORGANIZE BY COLUMN

    PARTITION BY RANGE(ORIGIN_DATE)

        (STARTING ('2020-01-01') ENDING ('2022-12-31') EVERY 1 MONTH);



    ------------------------------
    LIAK KUAN TAN
    ------------------------------


  • 2.  RE: table partition

    Posted Fri February 17, 2023 04:24 AM
    Edited by Yves-Antoine Emmanuelli Fri February 17, 2023 04:29 AM

    Hello Liak,

    First, your CREATE TABLE statement contains 2 errors :

    1. A comma is missing after ORIGIN_DATE DATE NOT NULL
    2. The table partitioning feature is not supported for column organized tables.

    After correction, and execution of the CREATE TABLE statement, the following error is reported :

    SQL0327N  The row cannot be inserted into table "YAE.ANALYTICS01" because it 
    is outside the bounds of the defined data partition ranges.  SQLSTATE=22525

    Regards



    ------------------------------
    Yves-Antoine Emmanuelli
    ------------------------------



  • 3.  RE: table partition

    Posted Sat February 18, 2023 10:51 AM

    you just get an sql error - no partition available .....

    --
    Best Regards, ????????Beste Groeten, ???????? Meilleures Salutations
    Guy Przytula
    ??
    Tel. GSM??: +32 (0)475-33.81.86

    Email : Guy Przytula


    ?????????????????????????????????? signature ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???????????????????????????????????????????????????? ?? ???? ??
    ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???? ??
    Infocura - Tel : +32 (0) 478 32 83 54