0

嗨,我有以下脚本来创建带有分区和子分区的表,其中包含范围和列表:

CREATE TABLE C##API_USER.METERENERGY 
(
  METERID NUMBER NOT NULL 
, ENERGY_ACTIVE_EXPORT FLOAT(63) 
, ENERGY_ACTIVE_IMPORT FLOAT(63) 
, ENERGY_REACTIVE_EXPORT FLOAT(63) 
, ENERGY_REACTIVE_IMPORT FLOAT(63) 
, COL_G_DATE NUMBER(10) 
) 
LOGGING 
TABLESPACE HEDC_TABLE_SPACE 
PARTITION BY RANGE (COL_G_DATE) 
SUBPARTITION BY LIST (METERID) 
(
  PARTITION C##API_USER.COL_G_DATE_1483228800 VALUES LESS THAN (1483228800‬)        TABLESPACE HEDC_TABLE_SPACE  
, PARTITION C##API_USER.COL_G_DATE_1485820800 VALUES LESS THAN (1485820800)     TABLESPACE HEDC_TABLE_SPACE 
, PARTITION C##API_USER.COL_G_DATE_1488412800 VALUES LESS THAN (1488412800)     TABLESPACE HEDC_TABLE_SPACE
);

CREATE INDEX C##API_USER.METERENERGY_INDEX1 ON C##API_USER.METERENERGY (COL_G_DATE DESC, METERID ASC);


但 oracle 数据库显示错误报告:


Error starting at line : 1 in command -

Error report -
ORA-00926: missing VALUES keyword
00926. 00000 -  "missing VALUES keyword"
*Cause:    
*Action:




所以我错过了什么?(我正在使用 Oracle 19c 和 oracle sql Developer)如果你能帮我找到另一个答案谢谢:

Oracle 数据库按范围创建自动分区(长)

4

1 回答 1

1

缺少子分区。

这只是一个例子;你会使用聪明的价值观。

SQL> CREATE TABLE meterenergy
  2  (
  3     meterid                 NUMBER NOT NULL,
  4     energy_active_export    FLOAT (63),
  5     energy_active_import    FLOAT (63),
  6     energy_reactive_export  FLOAT (63),
  7     energy_reactive_import  FLOAT (63),
  8     col_g_date              NUMBER (10)
  9  )
 10  PARTITION BY RANGE (col_g_date)
 11     SUBPARTITION BY LIST (meterid)
 12     (PARTITION col_g_date_1483228800 VALUES LESS THAN (1483228800)
 13         (SUBPARTITION sub1 VALUES (1),
 14          SUBPARTITION sub2 VALUES (2)
 15         ),
 16      PARTITION col_g_date_1485820800 VALUES LESS THAN (1485820800)
 17         (SUBPARTITION sub3 VALUES (3),
 18          SUBPARTITION sub4 VALUES (4)
 19         )
 20     );

Table created.

SQL>
于 2020-05-29T06:27:03.523 回答