bart_k_pl wrote:Getting closer.
i got clue that it should look more or less like this:
stmt:='create table '||name||'(';
for x in (select * from all_tab_columns where table_name=name) loopOther things you will have to deal with are commas at the and of all but the last column definition.
end loop;You should use dbms_output.put_line to check your string in stmt variable looks like a valid create table command.
execute immediate stmt;
create new_table as select * from existing_table where 0 = 1;