zoukankan      html  css  js  c++  java
  • oracle表范围分区的测试例子

    -- Create sequence
    create sequence SQ1
    minvalue 1
    maxvalue 999999999999999999999999999
    start with 2001
    increment by 1
    cache 20;

    序列的建立

    create table testpatition
    (
    Gid number(10,3) primary key,
    GName varchar2(36),
    GDate date
    )
    partition by range(Gid) 选择要分区的字段
    (
    partition p1 values less than(10), 确定分区的范围
    partition p2 values less than(20),
    partition p3 values less than(30),
    partition p4 values less than(300),
    partition p5 values less than(600),
    partition p6 values less than (maxvalue)最大分区的数据
    );

    表分区的建立

    declare
    n number:=1;
    begin
    while n<2000 loop
    insert into testpatition(gid,GName,Gdate) values(sq1.nextval,n,sysdate);
    n:=n+1;
    end loop;
    end;

    测试数据的添加

    select * from testpatition partition (p4)

    查询分区的数据的例子

    select * from testpatition

    查询所有的数据

  • 相关阅读:
    1015
    1016
    1014
    1002
    1010
    1006
    动态规划1001
    动态规划1002
    使用EF框架调用带有输出参数(output)的存储过程
    工程地质相关知识
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835539.html
Copyright © 2011-2022 走看看