oracle 复制数据并插入当前表的语句

来源:互联网 发布:福州橙子网络 编辑:程序博客网 时间:2024/06/05 17:13

1.创建表
create table student(
id number(19) not null,
name varchar2(20),
sex number(2),
primary key(id)
)

2.创建序列
create sequence s_student
increment by 1
start with 1
nomaxvalue
nocycle
nocache

3.插入若干条数据
insert into student values(s_student.nextval, 'student001', 0);
insert into student values(s_student.nextval, 'student002', 0);
insert into student values(s_student.nextval, 'student003', 0);
insert into student values(s_student.nextval, 'student004', 0);
insert into student values(s_student.nextval, 'student005', 0);

4.复制数据并插入当前表的语句
insert into 
student
select s_student.nextval, student.name, student.sex from student;

原创粉丝点击