修改表结构的语句

alter table crm_ict_orderInfo rename column starttime to starttime_temp;
alter table crm_ict_orderInfo add starttime date;
update crm_ict_orderInfo set starttime =to_date(starttime_temp,'yyyy-mm-dd hh24:mi:ss')
alter table crm_ict_orderInfo drop (starttime_temp);

alter table crm_ict_orderInfo rename column endtime to endtime_temp;
alter table crm_ict_orderInfo add endtime date;
update crm_ict_orderInfo set endtime =to_date(endtime_temp,'yyyy-mm-dd hh24:mi:ss')
alter table crm_ict_orderInfo drop (endtime_temp);


select * from crm_ict_orderInfo order by starttime desc
select count(0) from crm_ict_orderInfo partition(region_00)

alter table crm_ict_orderInfo rename column starttime to starttime_temp;
alter table crm_ict_orderInfo add starttime date;
update crm_ict_orderInfo set starttime =to_date(starttime_temp,'yyyy-mm-dd hh24:mi:ss')
alter table crm_ict_orderInfo drop (starttime_temp);
alter table crm_ict_orderInfo rename column endtime to endtime_temp;
alter table crm_ict_orderInfo add endtime date;
update crm_ict_orderInfo set endtime =to_date(endtime_temp,'yyyy-mm-dd hh24:mi:ss')
alter table crm_ict_orderInfo drop (endtime_temp);

-删除分区数据-

ALTER TABLE crm_ict_orderInfo TRUNCATE PARTITION region_18

-循环给一个分区加入几十万数据-

declare 
 x number;
begin
  x := 0;
  while x < 10000 loop
  x := x+1;
  insert into CRM_ICT_ORDERINFO (order_id, user_id, region, region_name, phonenumber, productname, productnumber2, commoditycode, commodityname, type, starttime, endtime)
values ('200006136811076196', '18091103', '00', '镇江地区', '13501180285', '产品变更', '主体产品变更', '2400000280', 'LTE服务', 'T', to_date('01-10-2018 16:46:28', 'dd-mm-yyyy hh24:mi:ss'), to_date('02-08-2018 16:46:39', 'dd-mm-yyyy hh24:mi:ss'));

commit;
end loop;
end;

给表添加索引

create index crm_ict_orderInfo_index on 
crm_ict_orderinfo(order_id,phonenumber) 
local (partition region_00,partition region_11,
	   partition region_12,partition region_13,
	   partition region_14,partition region_15,
	   partition region_16,partition region_17,
	   partition region_18,partition region_19,
	   partition region_20,partition region_21,
	   partition region_22,partition region_23);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值