a.
DECLARE
A NUMBER;
B NUMBER;
C NUMBER;
TIME1 NUMBER;
TIME2 NUMBER;
BEGIN
A := 10000;
B := 0;
TIME1 :=DBMS_UTILITY.GET_TIME;
WHILE B + 1 < A LOOP
INSERT INTO T
SELECT ROWNUM+B,T.* FROM ALL_OBJECTS T WHERE ROWNUM <= A - B;
C := SQL%ROWCOUNT;
B := B + C;
COMMIT;
END LOOP;
TIME2 :=DBMS_UTILITY.GET_TIME;
DBMS_OUTPUT.PUT_LINE(TIME2 - TIME1);
END;
b.
CREATE OR REPLACE PROCEDURE BIG_TABLE(A IN NUMBER, TIM OUT NUMBER) IS
/*
CREATE TABLE T AS SELECT ROWNUM ID,A.* FROM ALL_OBJECTS AWHERE 1=2;
*/
B NUMBER;
C NUMBER;
TIME1 NUMBER;
TIME2 NUMBER;
BEGIN
B := 0;
TIME1 :=DBMS_UTILITY.GET_TIME;
WHILE B + 1 < A LOOP
INSERT INTO T
SELECT ROWNUM + B, T.* FROM ALL_OBJECTS T WHERE ROWNUM <= A - B;
C := SQL%ROWCOUNT;
B := B + C;
COMMIT;
END LOOP;
TIME2 :=DBMS_UTILITY.GET_TIME;
TIM := TIME2 - TIME1;
END BIG_TABLE;