Don't worry, I wasn't taking it personally (best call off the hitman :) ).
A couple of people mentioned performance. Take a look at the example below. I ran the two loops a few times and these results seem pretty consistent on my machine:
This example is worh looking at:
CREATE TABLE table1
(id NUMBER(10),
col1 VARCHAR2(50),
col2 VARCHAR2(50));
CREATE OR REPLACE PROCEDURE Table1_Insert
(p_id IN table1.id%TYPE,
p_col1 IN table1.col1%TYPE,
p_col2 IN table1.col2%TYPE) IS
BEGIN
INSERT INTO table1
(id, col1, col2)
VALUES
(p_id, p_col1, p_col2);
END;
/
SET TIMING ON
SQL> DECLARE
2 v_col1 table1.col1%TYPE := '1234567890';
3 v_col2 table1.col2%TYPE := '12345678901234567890';
4 BEGIN
5 FOR i IN 1 .. 10000 LOOP
6 Table1_Insert(i, v_col1, v_col2);
7 END LOOP;
8 END;
9 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.02
SQL>
SQL> ROLLBACK;
Rollback complete.
Elapsed: 00:00:00.05
SQL>
SQL> DECLARE
2 v_col1 table1.col1%TYPE := '1234567890';
3 v_col2 table1.col2%TYPE := '12345678901234567890';
4 BEGIN
5 FOR i IN 1 .. 10000 LOOP
6 INSERT INTO table1
7 (id, col1, col2)
8 VALUES
9 (i, v_col1, v_col2);
10 END LOOP;
11 END;
12 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:01.08
SQL>
SQL> ROLLBACK;
I know it's a crap test, but it's interesting.
