Search code examples
oracle-databasesyntax-errorpartitioningddlcreate-table

ORA-00926 when trying to create a Range Partition


SQL> create table contracts_range (
  2  document_no integer not null,
  3  contract_date date,
  4  start_date date,
  5  end_date date,
  6  salary float)
  7  partition by range (contract_date)
  8  (
  9  partition contracts_jan2020 VALUE LESS THAN ('2020-01-31'),
 10  partition contracts_fen2020 VALUE LESS THAN ('2020-03-01'),
 11  partition contracts_mar2020 VALUE LESS THAN ('2020-03-31'));

ERROR at line 9: ORA-00926: missing VALUES keyword


Solution

  • It's "values less than", in plural, not "value less than":

    create table contracts_range (
    document_no integer not null,
    contract_date date,
    start_date date,
    end_date date,
    salary float)
    partition by range (contract_date)
    (
        partition contracts_jan2020 VALUES LESS THAN ('2020-01-31'),
        -- Here -------------------------^
        partition contracts_fen2020 VALUES LESS THAN ('2020-03-01'),
        -- Here -------------------------^
        partition contracts_mar2020 VALUES LESS THAN ('2020-03-31')
        -- Here -------------------------^
    );