測試需求,id、姓名、郵箱、手機號不可重覆 1.創建序列 2.創建表 3.for迴圈插入數據 插入效果如下 ...
測試需求,id、姓名、郵箱、手機號不可重覆
1.創建序列
create sequence id_sequence; //創建序列id_sequence
2.創建表
create table USERINFO( ids number(11) NOT NULL, activity_name varchar(255) NOT NULL, intractive_type varchar(255) DEFAULT NULL NOT NULL, email varchar(255) NOT NULL, mobile int NOT NULL, userAgent varchar(255) NOT NULL, email_title varchar(255) NOT NULL, label varchar(255) NOT NULL, category1 varchar(255) NOT NULL, time date NOT NULL, time1 date NOT NULL, primary key(ids) );
3.for迴圈插入數據
declare i number; begin for i in 100..130 //100..130代表迴圈30次,按需求修改 loop insert into USERINFO values(id_sequence.nextval,'這是名字'||id_sequence.nextval,'現金',137||lpad(id_sequence.nextval,8,0)||'@qq.com',137||lpad(id_sequence.nextval,8,0),2,1,2,20,to_date('2018-09-29','yyyy-mm-dd'),to_date('2018-09-29','yyyy-mm-dd')); end loop; commit; end;
插入效果如下