dba要细心:字段名顺序乱带来的问题

这次对自己维护的数据库要进行数据清理

create table TB_temp

(
a number,

b number ,

c number not null,
);

--插入数据到临时表中
insert into TB_temp

select * from tb_table

  where  a >0;

报错 cannot insert null to c

一查发现

tb_table 的顺序为

a,

c ,

b

所以为了避免这个错误,一定要指定列名
insert into TB_CLIENT_WIN_LOST_REPBK (
a,b,c)
select  a,b,c  where a>0;

或者

create table tb_temp as select * from tb_test where a>0

也可以避免

所以说 dba要细心,不能为了省事用 select   *  来代替

 

请使用浏览器的分享功能分享到微信等