学习oracle技术,每天学一点,每天进步一点

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

上一篇 / 下一篇  2008-04-03 17:09:49 / 个人分类:学习

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

create table TB_temp

(
{8H4U%l6e8L0a number,

b number ,

c number not null,ITPUB个人空间kQm;Zy&Nzv
);

--插入数据到临时表中ITPUB个人空间4X.{/|6p$a)P4r9L
insert into TB_temp

select * from tb_table

  where  a >0;

报错 cannot insert null to c

一查发现

tb_table 的顺序为

a,

c ,

b

所以为了避免这个错误,一定要指定列名
pf0xY} o,G0insert into TB_CLIENT_WIN_LOST_REPBK (ITPUB个人空间)s\)s~L
a,b,c)ITPUB个人空间$Q$A-R+s?
select  a,b,c  where a>0;

或者

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

也可以避免

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

 


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-11-21  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

数据统计

  • 访问量: 24674
  • 日志数: 309
  • 图片数: 2
  • 建立时间: 2007-12-11
  • 更新时间: 2008-11-21

RSS订阅

Open Toolbar