You are right in my opinion.
PLS_INTEGER is only appropriate for performance in very localized code (it almost ALWAYS gets turned into a number anyway.
The theoretical gains are way outweighed by ease of programming, and using %type is great.
I might, *might* use pls_integer or binary_integer or some other type in some very very tight code that had to be tuned to DEATH.
Using my simple test harness:
</code>
http://asktom.oracle.com/~tkyte/runstats.html <code>
we can see that simply passing the parameters results in no gain or loss:
ops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p1( x in pls_integer )
2 as
3 begin
4 null;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM>
ops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p2( x in number )
2 as
3 begin
4 null;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM> declare
2 l_start number;
3 l_run1 number;
4 l_run2 number;
5
6 l_p1 pls_integer := 0;
7 l_p2 number := 0;
8 begin
9 insert into run_stats select 'before', stats.* from stats;
10
11 l_start := dbms_utility.get_time;
12 for i in 1 .. 1000000
13 loop
14 p1( l_p1 );
15 end loop;
16 l_run1 := (dbms_utility.get_time-l_start);
17 dbms_output.put_line( l_run1 || ' hsecs' );
18
19 insert into run_stats select 'after 1', stats.* from stats;
20 l_start := dbms_utility.get_time;
21 for i in 1 .. 1000000
22 loop
23 p2( l_p2 );
24 end loop;
25 l_run2 := (dbms_utility.get_time-l_start);
26 dbms_output.put_line( l_run2 || ' hsecs' );
27 dbms_output.put_line
28 ( 'run 1 ran in ' || round(l_run1/l_run2*100,2) || '% of the time' );
29
30 insert into run_stats select 'after 2', stats.* from stats;
31 end;
32 /
724 hsecs
723 hsecs
run 1 ran in 100.14% of the time
PL/SQL procedure successfully completed.
in 1,000,000 calls... and for many general operationsops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p1( x in out pls_integer )
2 as
3 begin
4 select count(*) into x from dual;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM>
ops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p2( x in out number )
2 as
3 begin
4 select count(*) into x from dual;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM> declare
2 l_start number;
3 l_run1 number;
4 l_run2 number;
5
6 l_p1 pls_integer := 0;
7 l_p2 number := 0;
8 begin
9 insert into run_stats select 'before', stats.* from stats;
10
11 l_start := dbms_utility.get_time;
12 for i in 1 .. 100000
13 loop
14 p1( l_p1 );
15 end loop;
16 l_run1 := (dbms_utility.get_time-l_start);
17 dbms_output.put_line( l_run1 || ' hsecs' );
18
19 insert into run_stats select 'after 1', stats.* from stats;
20 l_start := dbms_utility.get_time;
21 for i in 1 .. 100000
22 loop
23 p2( l_p2 );
24 end loop;
25 l_run2 := (dbms_utility.get_time-l_start);
26 dbms_output.put_line( l_run2 || ' hsecs' );
27 dbms_output.put_line
28 ( 'run 1 ran in ' || round(l_run1/l_run2*100,2) || '% of the time' );
29
30 insert into run_stats select 'after 2', stats.* from stats;
31 end;
32 /
2288 hsecs
2266 hsecs
run 1 ran in 100.97% of the time
PL/SQL procedure successfully completed.
You'll see no measurable difference. Just to be fair -- for somethings, it can be effective:ops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p1( x in out pls_integer )
2 as
3 begin
4 x := x+1;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM>
ops$tkyte@ORA817DEV.US.ORACLE.COM> create or replace procedure p2( x in out number )
2 as
3 begin
4 x := x+1;
5 end;
6 /
Procedure created.
ops$tkyte@ORA817DEV.US.ORACLE.COM> declare
2 l_start number;
3 l_run1 number;
4 l_run2 number;
5
6 l_p1 pls_integer := 0;
7 l_p2 number := 0;
8 begin
9 insert into run_stats select 'before', stats.* from stats;
10
11 l_start := dbms_utility.get_time;
12 for i in 1 .. 100000
13 loop
14 p1( l_p1 );
15 end loop;
16 l_run1 := (dbms_utility.get_time-l_start);
17 dbms_output.put_line( l_run1 || ' hsecs' );
18
19 insert into run_stats select 'after 1', stats.* from stats;
20 l_start := dbms_utility.get_time;
21 for i in 1 .. 100000
22 loop
23 p2( l_p2 );
24 end loop;
25 l_run2 := (dbms_utility.get_time-l_start);
26 dbms_output.put_line( l_run2 || ' hsecs' );
27 dbms_output.put_line
28 ( 'run 1 ran in ' || round(l_run1/l_run2*100,2) || '% of the time' );
29
30 insert into run_stats select 'after 2', stats.* from stats;
31 end;
32 /
93 hsecs
171 hsecs
run 1 ran in 54.39% of the time
PL/SQL procedure successfully completed.
but in most cases, it'll be a wash, and in the case you identify as a bottleneck (using dbms_profiler for example) you would "tune" to death.