1. 新增一个表,通过另一个表的结构和数据
create table XTHAME.tab1 as select * from DSKNOW.COMBDVERSION
2. 如果表存在:
insert into tab1 select * from tab2;
3.同一个表中,将A字段的指赋给B字段:
update table_name set B = A;
4. 将一个表的字段数据插入到另一个表的字段数据中
insert into XTHAME.tab1(pk_bdversion,vbdcode) select pk_bdversion,vbdcode from DSKNOW.COMBDVERSION;
* 如果报提醒:ORA-00928: 缺失 SELECT 关键字错误
原因是:这里tab1(Field1,Field2,….)不能加单引号
5. 第4点的延伸,多个表的多个字段,插入同一个表的多个字段。
INSERT INTO XTHAME.BUTTON (button_id, button_name, button_code) select a.pk_examquest, b.pk_bdversion,a.vquestname FROM DSKNOW.COMBDVERSION b ,DSKNOW.RQT_EXAMQUEST a where a.pk_examquest=’1001SX1000000000JOBV’ and b.pk_bdversion=’1000BDV1000010101001′;