FOR
I
IN
1
..
100000
LOOP
EXECUTE
IMMEDIATE
'INSERT INTO T VALUES('
||
I
||
')'
;
COMMIT
;
END
LOOP;
END
;
动态SQL + 绑定变量
BEGIN
FOR I IN 1 .. 100000 LOOP
EXECUTE IMMEDIATE
'INSERT INTO T VALUES(:X)'USING(I);
COMMIT;
END LOOP;
END;
静态SQL自动绑定变量
静态SQL 在编译时解析,而动态SQL 在运行时解析
BEGIN
FOR I IN 1 .. 100000 LOOP
INSERT INTO T VALUES(I);
COMMIT;
END LOOP;
END;
BEGIN
FOR I IN 1 .. 100000 LOOP
INSERT INTO T VALUES(I);
END LOOP;
COMMIT;
END;
BEGIN
INSERT INTO T SELECT ROWNUM X FROM DUAL CONNECT BY LEVEL <=100000;
COMMIT;
END;
直接路径读取
BEGIN
EXECUTE IMMEDIATE
'CREATE TABLE T AS SELECT ROWNUM X FROM DUAL CONNECT BY LEVEL <=100000';
COMMIT;
END;
硬件比拼,同时使用多个CPU处理