17.The INV_HISTORY table is created using the command:
SQL>CREATE TABLE INV_HISTORY (inv_no NUMBER(3), inv_date DATE, inv_amt NUMBER(10,2)) partition by range (inv_date) interval (numtoyminterval(1,'month')) (partition p0 values less than (to_date('01-01-2005','dd-mm-yyyy')), partition p1 values less than (to_date('01-01-2006','dd-mm-yyyy'))); The following data has been inserted into the INV_HISTORY table : INV_NO INV_DATE INV_AMT 1 30-dec-2004 1000 2 30-dec-2005 2000 3 1-feb-2006 3000 4 1-mar-2006 You would like to store the data belonging to the year 2006 in a single partition and issue the command: SQL> ALTER TABLE inv_history MERGE PARTITIONS FOR(TO_DATE('15-feb-2006','dd-mon-yyyy')), FOR(TO_DATE('15-apr-2006')) INTO PARTITION sys_py; What would be the outcome of this command? A. It executes successfully, and the transition point is set to '1-apr-2006'. B. It executes successfully, and the transition point is set to '15-apr-2006'. C. It produces an error because the partitions specified for merging are not adjacent. D. It produces an error because the date values specified in the merge do not match the date values stored in the table. Answer: C参考:
CREATE TABLE INV_HISTORY (inv_no NUMBER(3), inv_date DATE, inv_amt NUMBER(10,2)) partition by range (inv_date) interval (numtoyminterval(1,'month')) (partition p0 values less than (to_date('01-01-2005','dd-mm-yyyy')), partition p1 values less than (to_date('01-01-2006','dd-mm-yyyy')));insert into inv_history values(1, to_date(20041230,'yyyymmdd'), 1000 );
insert into inv_history values(2, to_date(20051230,'yyyymmdd'), 2000 ); insert into inv_history values(3, to_date(20060201,'yyyymmdd'), 3000 ); insert into inv_history values(4, to_date(20060301,'yyyymmdd'), 4000 ); commit; 通过以上语句执行,总共有4个分区: P0,P1,SYS_P41,SYS_P42. ALTER TABLE inv_history MERGE PARTITIONS FOR(TO_DATE('15-feb-2006','dd-mon-yyyy')), FOR(TO_DATE('15-apr-2006')) INTO PARTITION sys_py; --提示指定分区不存在 ALTER TABLE inv_history MERGE PARTITIONS FOR(TO_DATE('20060201','yyyymmdd')), FOR(TO_DATE('2006301','yyyymmdd')) INTO PARTITION sys_py; 这样可将SYS_P41,SYS_P42合并为sys_py,其中for中的值一定要是分区值,否则无法合并,会提示指定分区不存在.