高效SQL

2018-08-22  本文已影响0人  奇乞祈兴
select colA, dump(colA), ascii(colA),colb from kkss order by  colA desc


create table kkss(colA char(10),colAA varchar(10),colB number);
  insert into  kkss values('a','a',1);
      insert into  kkss values('bb','bb',2);    
      insert into  kkss values('5','5',5);
      insert into  kkss values('44','44',44);
      insert into  kkss values('33','33',33);

create table LCK
(name varchar2(60),
 sex  varchar2(10),
 old  number (20),
 comments varchar2(30))
 
 
PCTFREE 99 PCTUSED 1;


DECLARE n number;
        t_name varchar2(60);
        t_sex  varchar2(20);
        t_comments  varchar2(30);
BEGIN    
FOR I IN 1..16000 LOOP
    t_name:='1234567890,1234567890,1234567890,1234567890,1234567890,'||to_char(I);
    t_sex:='mail'||to_char(I);
    t_comments:='verygood'||to_char(I);
    n:=n+1;
execute immediate  'INSERT INTO LCK (name,sex,old,comments) VALUES(:v1,:v2,:v3,:v4)' using t_name,t_sex,I,t_comments ;
commit;
END LOOP;
END;

create table LCK
(name varchar2(60),
 sex  varchar2(10),
 old  number (20),
 comments varchar2(30))

PARTITION BY RANGE (old)
(
PARTITION p1 VALUES LESS THAN (1000), 
PARTITION p2 VALUES LESS THAN (2000), 
PARTITION p3 VALUES LESS THAN (3000), 
PARTITION p4 VALUES LESS THAN (4000), 
PARTITION p5 VALUES LESS THAN (5000), 
PARTITION p6 VALUES LESS THAN (6000), 
PARTITION p7 VALUES LESS THAN (7000), 
PARTITION p8 VALUES LESS THAN (8000), 
PARTITION p9 VALUES LESS THAN (9000), 
PARTITION p10 VALUES LESS THAN (10000), 
PARTITION p11 VALUES LESS THAN (MAXVALUE))
上一篇下一篇

猜你喜欢

热点阅读