Hi Kai,
Your CREATE TABLE sql is generating incorrect statements with single quotes around table name. These are generated as follows:
create table '0'(id int)
create table '1'(id int)
create table '2'(id int)
create table '3'(id int)
create table '4'(id int)
Please change the following line as mentioned with double quote instead of single quote:
v_sql := 'create table "'|| :tbname || '" (id int)';
And it should work fine.
Regards,
Ravi