zhyiwww
          用平實的筆,記錄編程路上的點點滴滴………
          posts - 536,comments - 394,trackbacks - 0

          Oracle 循環(huán)插入測試數(shù)據(jù)(網(wǎng)上收集整理)

          ??????????????????????????????????????

          ??? declare
          ??????? maxrecords constant int:=1000;
          ??????? i int :=1;
          ??? begin
          ??????? for i in 1..maxrecords loop
          ????????? insert into UserInfo(UserID,login,password,firstName,lastName,ISADMINISTRATOR)
          ?????????? values(SYS_GUID(),TO_CHAR('9999'+i),'password','fristname','lastName','0');
          ??????? end loop;
          ??? dbms_output.put_line('
          成功錄入數(shù)據(jù)! ');
          ??? commit;
          ??? end;

          SYS_GUID()? 生成 GUID ORACLE

          NEWID?? 生成 GUID? SQLSERVERR

          declare

          定義部分標識

          maxrecords constant int:=100;

          定義 maxrecords 為整型常量 100

          i int :=1;

          定義 i 為整型值變量,初值為 1

          Begin

          執(zhí)行部分標識

          for i in 1..maxrecords loop

          i 1 循環(huán)到 maxrecords

          Insert into tempuser.testtable(recordnumber,currentdate) values (i,sysdate);

          向數(shù)據(jù)表中插入數(shù)據(jù)

          end loop;

          結(jié)束循環(huán)

          dbms_output.put_line(' 成功錄入數(shù)據(jù)! ');

          顯示成功錄入數(shù)據(jù)信息

          commit;

          提交結(jié)果

          end;

          結(jié)束執(zhí)行



          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2006-05-23 17:14 zhyiwww 閱讀(10037) 評論(8)  編輯  收藏 所屬分類: database

          FeedBack:
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2006-08-04 11:31 | aa
          3Q
          頂....  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)[未登錄]
          2007-01-21 15:21 | dingding
          謝謝
          正需要  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2007-09-14 10:53 | tt
          begin
          for i in 1..1000 loop
          insert into test values(col1,col2,col3....);
          end loop;
          end;
          /
            回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2007-12-27 12:39 | coolrl
          不錯  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2008-03-06 09:32 | guoke
          錄到最大的數(shù)據(jù)后才提交,性能能好嗎?  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2008-03-24 16:45 | www
          thank you !  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)[未登錄]
          2008-09-18 22:11 | yy
          thank you  回復  更多評論
            
          # re: Oracle循環(huán)插入測試數(shù)據(jù)
          2009-02-25 16:29 | gli
          thanks  回復  更多評論
            
          主站蜘蛛池模板: 莲花县| 西青区| 荔波县| 罗甸县| 海口市| 曲靖市| 长兴县| 顺平县| 巫溪县| 灵寿县| 德兴市| 邹城市| 望奎县| 天峨县| 安国市| 桦南县| 蕲春县| 凤凰县| 南丹县| 莱芜市| 江永县| 南汇区| 东城区| 楚雄市| 屯昌县| 丰县| 甘泉县| 綦江县| 徐汇区| 芮城县| 延安市| 海阳市| 昌黎县| 昆明市| 左云县| 抚州市| 太白县| 鹤壁市| 三原县| 博湖县| 屯留县|