oracle里BULKINSERT怎麼用最好給我個簡單在例子?
--創建測試表create tablebulk_objectstablespace usersasselect object_name, object_type from dba_objects;--定義模擬批量所需變量DECLARETYPE t_tab IS TABLE OF bulk_objects%ROWTYPE;objects_tab t_tab := t_tab()
;start_time number; end_time number;BEGINSELECT *BULK COLLECT INTO objects_tabFROM bulk_objects;--模擬批量取數插入Start_time := DBMS_UTILITY.get_time;FORALL i in objects_tab.first .. objects_tab.lastINSERT INTO bulk_objects VALUES objects_tab(i)
;end_time := DBMS_UTILITY.get_time;DBMS_OUTPUT.PUT_LINE('Conventional Insert: '||to_char(end_time-start_time));COMMIT;END;/--可見開啟批量的操作符關鍵在于:BULK COLLECT,FORALL--如果是高級語言的話、關鍵是構造并傳遞能映射到相應TYPE的table數組到后臺。