Inner procedure in an anonymous function : Code Block « PL SQL Programming « Oracle PL/SQL Tutorial






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>








24.4.Code Block
24.4.1.This is an anonymous procedure, so it has no name
24.4.2.A PL/SQL Block
24.4.3.Uses a PL/SQL Nested Block
24.4.4.Inline procedure
24.4.5.the forward slash on a line by itself says execute this procedure
24.4.6.Inner function
24.4.7.Select the first names for the Doe family from the Worker table.
24.4.8.Inner procedure in an anonymous function
24.4.9.Demonstrate nested PL/SQL blocks