Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2594200
  • 博文数量: 2110
  • 博客积分: 18861
  • 博客等级: 上将
  • 技术积分: 24420
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-05 18:23
文章分类

全部博文(2110)

文章存档

2011年(139)

2010年(1971)

我的朋友

分类: Oracle

2010-09-30 10:59:52

 

 -- Create table

  create table TL_SMS_SENDTASKLIST_10

  (

  NUMSEQID           NUMBER(20) not null,

  DATCREATETIME      DATE default SYSDATE not null,

  DATSRCSENDTIME     DATE not null,

  DATSRCENDTIME      DATE not null,

  NUMSRCCLIENTID     INTEGER,

  NUMDESTCLIENTID    INTEGER,

  NUMMESSAGEFORMAT   INTEGER not null,

  NUMMESSAGEPRIORITY INTEGER not null,

  VC2DESTMOBILE      VARCHAR2(60) not null,

  VC2SRCNUMBER       VARCHAR2(21) default '',

  VC2LINKID          VARCHAR2(20) default '',

  VC2MESSAGECONTENT VARCHAR2(2000) not null,

  NUMREPORTTYPE      INTEGER,

  VC2RESERVE1        VARCHAR2(200) default '',

  VC2RESERVE2        VARCHAR2(200) default '',

  NUMOPERATORID      INTEGER not null,

  NUMPRODUCTID       INTEGER not null,

  NUMCHANNELID       INTEGER default 0,

  NUMPROVINCEID      INTEGER default 0,

  NUMCITYID          INTEGER default 0,

  NUMCOUNTYID        INTEGER default 0,

  NUMSENDGROUPID     INTEGER default 0,

  NUMSRCSEQID        NUMBER(20) default 0,

  NUMSVCID           INTEGER not null,

  NUMMESSAGETYPE     INTEGER not null,

  VC2SERVICECODE     VARCHAR2(10) not null,

  NUMFEETYPE         INTEGER default 0 not null,

  NUMFEEVALUE        INTEGER default 0 not null,

  DATDEALTIME        DATE,

  NUMDEALFLAG        INTEGER not null,

  NUMMOSEQID         NUMBER(20),

  NUMSYSSEQID        NUMBER(20),

  NUMCOUNTMOBILE     NUMBER(3) default 1 not null

  )

  tablespace TYUSER_SMS_SENDTASKLIST

  pctfree 10

  initrans 1

  maxtrans 255

  storage

  (

  initial 64K

  minextents 1

  maxextents unlimited

  );

  -- Create/Recreate primary, unique and foreign key constraints

  alter table TL_SMS_SENDTASKLIST_10

  add constraint PK_TL_SMS_SENDTASKLIST_10 primary key (NUMSEQID)

  using index

  tablespace TYUSER_SMS_SENDTASKLIST_IDX

  pctfree 10

  initrans 2

  maxtrans 255

  storage

  (

  initial 64K

  minextents 1

  maxextents unlimited

  );

  -- Create/Recreate indexes

  create index TL_SMS_SENDTASKLIST_10_IDX1 on TL_SMS_SENDTASKLIST_10 (NUMDEALFLAG, NUMMESSAGEPRIORITY)

  tablespace TYUSER_SMS_SENDTASKLIST_IDX

  pctfree 10

  initrans 2

  maxtrans 255

  storage

  (

  initial 64K

  minextents 1

  maxextents unlimited

  );

  --创建序列

  create sequence TLSEQ_SMS_SENDTASKLIST_10

  minvalue 1

  maxvalue 9999999999999999999999999999

  start with 1975281

  increment by 1

  cache 20;

  --插入数据

  insert into tl_sms_sendtasklist_10 (NUMSEQID, DATCREATETIME, DATSRCSENDTIME, DATSRCENDTIME, NUMSRCCLIENTID, NUMDESTCLIENTID, NUMMESSAGEFORMAT,

  NUMMESSAGEPRIORITY, VC2DESTMOBILE, VC2SRCNUMBER, VC2LINKID, VC2MESSAGECONTENT, NUMREPORTTYPE, VC2RESERVE1, VC2RESERVE2, NUMOPERATORID, NUMPRODUCTID,

  NUMCHANNELID, NUMPROVINCEID, NUMCITYID, NUMCOUNTYID, NUMSENDGROUPID, NUMSRCSEQID, NUMSVCID, NUMMESSAGETYPE, VC2SERVICECODE, NUMFEETYPE, NUMFEEVALUE,

  DATDEALTIME, NUMDEALFLAG, NUMMOSEQID, NUMSYSSEQID, NUMCOUNTMOBILE)

  values (TLSEQ_SMS_SENDTASKLIST_10.nextval, to_date('27-09-2010', 'dd-mm-yyyy'), to_date('27-09-2010', 'dd-mm-yyyy'), to_date('29-09-2010', 'dd-mm-yyyy'), 0,

  10, 15, 3, '13601001000', '', '', '测试级联', null, '', '', 1, 703, 0, 0, 0, 0, 1, 0, 1, 1, '1001', 0, 0, to_date('27-09-2010 17:35:31', 'dd-mm-yyyy

  hh24:mi:ss'), 0, null, null, 1 );

  //批量插入数据

  DECLARE

  i INT;

  BEGIN

  i := 0;

  WHILE(i < 10)

  LOOP

  i := i + 1;

  insert into tl_sms_sendtasklist_10 (NUMSEQID, DATCREATETIME, DATSRCSENDTIME, DATSRCENDTIME, NUMSRCCLIENTID, NUMDESTCLIENTID, NUMMESSAGEFORMAT,

  NUMMESSAGEPRIORITY, VC2DESTMOBILE, VC2SRCNUMBER, VC2LINKID, VC2MESSAGECONTENT, NUMREPORTTYPE, VC2RESERVE1, VC2RESERVE2, NUMOPERATORID, NUMPRODUCTID,

  NUMCHANNELID, NUMPROVINCEID, NUMCITYID, NUMCOUNTYID, NUMSENDGROUPID, NUMSRCSEQID, NUMSVCID, NUMMESSAGETYPE, VC2SERVICECODE, NUMFEETYPE, NUMFEEVALUE,

  DATDEALTIME, NUMDEALFLAG, NUMMOSEQID, NUMSYSSEQID, NUMCOUNTMOBILE)

  values (TLSEQ_SMS_SENDTASKLIST_10.nextval, to_date('27-09-2010', 'dd-mm-yyyy'), to_date('27-09-2010', 'dd-mm-yyyy'), to_date('29-09-2010', 'dd-mm-yyyy'), 0,

  10, 15, 3, '13601001000', '', '', '测试级联2222', null, '', '', 1, 703, 0, 0, 0, 0, 1, 0, 1, 1, '1001', 0, 0, to_date('27-09-2010 17:35:31', 'dd-mm-yyyy

  hh24:mi:ss'), 0, null, null, 1 );

  END LOOP;

  COMMIT;

  END;

  --没有用序列

  需要大量oracle测试数据时,可以使用以下方法。

  DECLARE

  i INT;

  BEGIN

  i := 0;

  WHILE(i < 100000)

  LOOP

  i := i + 1;

  INSERT INTO TEST_TABLE(ID, XM) VALUES(i, '姓名' || i);

  END LOOP;

  COMMIT;

  END;

阅读(424) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~