2014-02-10 59 views
0

爲了避免數據丟失,我只是想強制我的查詢在提取10條記錄時應用提交 ,那麼提取10條記錄時進行提交是否正確?提取10條記錄時提交提交是否正確?

begin 
    for i in 1..10 
    loop 
    insert into table_name 
     select A.column1, A.column2, 
      A.column3, A.column4, 
      B.column1,B.column2, 
      B.column3,sum(B.column4) as Namecolumn 
     from table1 a,table2 b 
     group by A.column1, A.column2, 
       A.column3, A.column4, 
       B.column1, B.column2, 
       B.column3 
    end loop 
    commit; 
end; 
+0

您有多少個記錄循環過?而且,您如何知道在隨後的循環迭代中已經插入了哪些記錄? – Incognito

+0

你試圖避免什麼樣的「數據丟失」?當你不解釋最初的任務/問題時,幾乎不可能提供任何建議。 – zerkms

+0

如果連接超時.. – sam

回答

3

不,這樣做沒有意義。它會讓系統中的不完整業務事務處理,然後您必須手動回滾或完成,並且會降低性能。只在每個完整的商業交易結束時提交。