发布网友 发布时间:2022-04-22 23:58
共2个回答
懂视网 时间:2022-05-02 07:41
-- Create table
create table TT_FVP_OCR_ADDRESS
(
id NUMBER not null,
waybill_no VARCHAR2(32) not null,
dest_zone_code VARCHAR2(32),
confidence NUMBER(16,4),
input_tm DATE,
insert_tm DATE default sysdate not null,
deal_flg NUMBER(2) default 0 not null,
deal_count NUMBER(2) default 0 not null,
deal_ip VARCHAR2(30),
deal_tm DATE,
ocr_addr VARCHAR2(1000)
)
partition by range (INSERT_TM)
(
partition TT_FVP_OCR_ADDRESS_P20170616 values less than (TIMESTAMP‘ 2017-06-17 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170617 values less than (TIMESTAMP‘ 2017-06-18 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170618 values less than (TIMESTAMP‘ 2017-06-19 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170619 values less than (TIMESTAMP‘ 2017-06-20 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170620 values less than (TIMESTAMP‘ 2017-06-21 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170621 values less than (TIMESTAMP‘ 2017-06-22 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170622 values less than (TIMESTAMP‘ 2017-06-23 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170623 values less than (TIMESTAMP‘ 2017-06-24 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170624 values less than (TIMESTAMP‘ 2017-06-25 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170625 values less than (TIMESTAMP‘ 2017-06-26 00:00:00‘),
partition TT_FVP_OCR_ADDRESS_P20170626 values less than (TIMESTAMP‘ 2017-06-27 00:00:00‘)
);
-- Add comments to the table
comment on table TT_FVP_OCR_ADDRESS
is ‘ocr地址表‘;
-- Add comments to the columns
comment on column TT_FVP_OCR_ADDRESS.id
is ‘ID‘;
comment on column TT_FVP_OCR_ADDRESS.waybill_no
is ‘运单号‘;
comment on column TT_FVP_OCR_ADDRESS.dest_zone_code
is ‘收方城市代码‘;
comment on column TT_FVP_OCR_ADDRESS.confidence
is ‘可信度‘;
comment on column TT_FVP_OCR_ADDRESS.input_tm
is ‘录单时间‘;
comment on column TT_FVP_OCR_ADDRESS.insert_tm
is ‘插入时间‘;
comment on column TT_FVP_OCR_ADDRESS.deal_flg
is ‘处理标志‘;
comment on column TT_FVP_OCR_ADDRESS.deal_count
is ‘处理次数‘;
comment on column TT_FVP_OCR_ADDRESS.deal_ip
is ‘处理IP‘;
comment on column TT_FVP_OCR_ADDRESS.deal_tm
is ‘处理时间‘;
comment on column TT_FVP_OCR_ADDRESS.ocr_addr
is ‘纠错地址‘;
create index IDX_TT_FVP_OCR_ADDRESS on TT_FVP_OCR_ADDRESS (DEAL_FLG)
local;
-- Create/Recreate primary, unique and foreign key constraints
alter table TT_FVP_OCR_ADDRESS
add constraint PK_TT_FVP_OCR_ADDRESS primary key (ID, INSERT_TM)
using index
local;
--创建FVP_OCR_ADDRESS表的序列
create sequence SEQ_TT_FVP_OCR_ADDRESS
minvalue 1
maxvalue 999999999999999999999
start with 1000
increment by 1
cache 20;
--维护分区
DECLARE
V_OUT VARCHAR2(2000);
BEGIN
DBAMON.CONFIG_TAB_POLICY(V_OUT,‘SSS‘,‘TT_FVP_OCR_ADDRESS‘,7,1,0,24,‘DAY‘);
DBMS_OUTPUT.PUT_LINE(V_OUT);
END;
SQL分区表示例
标签:input time dea incr cache default traints 序列 end
热心网友 时间:2022-05-02 04:49
有两种方法可以实现对一个表分区.一是创建一个新的标识为分区表的表(你可参照此步骤),然后把数据复制到这张新表,再对这两张表分别改名.或者,像我写在下面的,通过重建或创建一个聚集索引来达到分区一个表.