Dynamically create packages
SQL> declare
2 x varchar2(32767);
3 begin
4 for i in 1 .. 300 loop
5 x := x || ' procedure X'||i||';';
6 end loop;
7 execute immediate 'create or replace package aTest is '||x||' end;';
8 x := replace(x,';',' is y number; begin y := 1; end;');
9
10 execute immediate 'create or replace package body aTest is '||x||' end;';
11 end;
12 /
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category