易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle 分区拆分 不能插入数据 01502 索引失效

数据表day_energy当前为月分区表,分区信息如下:DE_200912,DE_201001,DE_201002.....,月分区表出现速度查询慢,因此通过建立日分区表进行改善。
拆分月分区表的语句为:
alter table day_energy split partition de_201001 at('20100102') into (partition de_20100101,partition de_20100102)
分析:
alter table 表名 split partition 分区名 at (分割日期) into (新分区1,新分区2);
如果简单的分区1个月的表,比较简单,但是如果要拆分一年的表,那就太复杂了。为了简单实现所以就通过以下这个过程进行批量拆分:
-- czc 拆分分区表
--将月分区表拆分成日分区表
declare
  v_tbl     varchar2(56);
  v_partion varchar2(56);
  datetime  date;
  v_sql     varchar2(1024);
  v_dt0     varchar2(8);
  v_dt1     varchar2(8); 
begin
  datetime:=to_date('2010-11-1','yyyy-MM-dd');
  v_tbl:='day_energy';
  while to_char(datetime,'yyyyMMdd')!='20110101' loop
     if to_char(datetime,'MM')=to_char(datetime+1,'MM') then
       v_dt0:=to_char(datetime,'yyyyMMdd');
       v_dt1:=to_char(datetime+1,'yyyyMMdd');
       if to_number(to_char(datetime,'dd'))=1 then
        v_partion:='DE_'||to_char(datetime,'yyyyMM');
       else
        v_partion:='DE_'||to_char(datetime,'yyyyMMdd');
       end if;
       v_sql:='alter table '||v_tbl||' split partition '||v_partion||' at ('''||v_dt1||''') into (partition DE_'||v_dt0||', partition DE_'||v_dt1||');';
       dbms_output.put_line(v_sql);
       --execute immediate v_sql;
     end if;
     datetime:=datetime+1;
  end loop;
end;
但是出问题了,发现da


相关文档:

trunc()函数的学习 (oracle)

trunc()函数有两种用法 1:后面跟日期  2: 后面跟数字
A: SELECT a.times,to_date(a.times,'yyyymmdd'),trunc(to_date(a.times,'yyyymmdd'),'month') from dmf_loan_limit a
显示的结果为:
1 20080131     2008-1-31    2008-1-1
2 20080131  &nb ......

Linux(Centos5.4)上安装oracle10gR2(10.2.1)

我用的是Centos5.4 DVD光盘安装的linux操作系统,安装linux的时候选上开发工具,Xmanager,与数据库相关的包。
操作系统安装完成之后需要进行一系列的配置才能安装oracle10g,下面把主要步骤记录下来。
1.安装完操作系统之后还是有些包没有安装,然而安装oracle10g的时候需要用到,没有安装的包有:
libXp-1.0.0-8.i386.rp ......

Oracle SQL实例

1。select * from a where a.rowid=(select min(b.rowid) from b where a.id=b.id);
create test1(
nflowid number primary key, 
ndocid number,
drecvdate date);
insert into test1 values (1, 12301, sysdate) ;
insert into test1 values (2, 12301, sysdate);
select * from test1 order by drecvdate:
......

oracle 10G 物化视图新特性(测试效果不理想)

http://mrhaozi.itpub.net/post/41048/495175
物化视图
利用强制查询重写和新的强大的调整顾问程序 — 它们使您不再需要凭猜测进行工作 — 的引入,在 10g 中管理物化视图变得更加容易
物化视图 (MV) — 也称为快照 — 一段时间来已经广泛使用。MV 在一个段中存储查询结果,并且能够在提交查询 ......

oracle数据库导进ACEESS的方法

 2010年2月3日,本人有一個興奮的小發現,实验证明,直接用TOAD将oracle数据库中的数据直接导入
ACCESS中是不可能的。那為了做到从TOAD中将数据导入ACCESS运用间接渠道。可以用文本文件或xls等文件。其实最令我感到惊喜的是,我是通过sql 2000作為一个间接的中介,因Ġ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号