SQL>
SQL> create table t ( x varchar2(30) );
Table created.
SQL>
SQL>
SQL> declare
2 procedure method1( p_data in varchar2 )
3 is
4 begin
5 execute immediate 'insert into t(x) values(:x)'
6 using p_data;
7 end method1;
8
9 procedure method2( p_data in varchar2 )
10 is
11 begin
12 execute immediate 'insert into t(x) values( ''' ||replace( p_data,'''', '''''' ) || ''' )';
13 end method2;
14 begin
15 for i in 1 .. 10000
16 loop
17 method1( 'row ' || I );
18 end loop;
19
20 for i in 1 .. 10000
21 loop
22 method2( 'row ' || I );
23 end loop;
24
25 end;
26 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table t;
Table dropped.
SQL>
SQL>
|