Oracle: Partition table by month

前端 未结 2 1571
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 13:19

My solution(months in german):

PARTITION BY LIST ((to_char(GEBURTSDATUM, \'Month\'))) 
(  
  PARTITION p1 VALUES(\'JANUAR\'),  
  PARTITION p2 VALUES(\'Februar\'         


        
相关标签:
2条回答
  • 2021-01-26 13:51

    If the table has a date column, the statement below can be used as an example for monthly partitioning starting from today (Oracle 11g):

    PARTITION BY RANGE (date_column)
                INTERVAL (NUMTODSINTERVAL(1,'month') )
                 (PARTITION p_first VALUES LESS THAN ('16-MAY-2016'));
    
    0 讨论(0)
  • 2021-01-26 13:55

    In 11g you can use function-based partitioning through defining a virtual column: http://www.oracle-base.com/articles/11g/partitioning-enhancements-11gr1.php#virtual_column_based_partitioning

    Otherwise, you must manually define and maintain a separate column for the partitioning month.

    I'd suggest using month numbers instead of names in either case.

    0 讨论(0)
提交回复
热议问题