我想写一个oracle的存取过程,往一个表中插入3000条记录,先做如下测试:如下:
create procedure user_initialize() as
begin
  delete from bua_organization;
  insert into bua_organization values(1, 'name', 'code', 0);
  commit;
end;
为何一条记录也插不进去,更不用说插3000条了插入3000条又该怎么写呢,时间紧张,没功夫来研究了,请高手指教呀。

解决方案 »

  1.   

    create or replace procedure user_initialize as
    begin
      delete from bua_organization;
      insert into bua_organization values(1, 'name', 'code', 0);
      commit;
    exception 
      when others then
      rollback;
      raise;
    end;
      

  2.   

    确定是插入3000条可以这样。FOR run_count IN 1..3000 LOOP
            insert();
        END LOOP;
      

  3.   

    错误的地方:
    user_initialize() 
    ========〉
    user_initialize另外最好加事务控制
      

  4.   

    insert into bua_organization(col1,col2,col3,col4) values(1, 'name', 'code', 0);
      

  5.   

    insert into bua_organization values(1, 'name', 'code', 0);
    这条语句中,插入表organization 没有写明字段名。这种写法,在编写程序时是需要尽力避免的。因为这样写,既不知道字段名,也不知道顺序,完全依赖于Oracle的当时建表的顺序,很容易出错。最好改在楼上所写的。