set heading off;
set termout off;
set echo off;
set VERIFY off;
set feedback off;
SET NEWPAGE none

set serveroutput on
spool C:\CreateTable.sql
select 'spool C:\CreateTable.log' from dual;
SELECT        'create table '
           || UPPER (table_name) 
           || CHR (10)
           || '('
           || SUBSTR (SYS_CONNECT_BY_PATH (   column_name
                                           || CHR (9)
                                           || data_type
                                           || DECODE (data_type,
                                                      'DATE', ''|| DECODE (column_id,cnt, '',','),
                                                      'NUMBER', '(' || data_precision || ',' || data_scale || ')' || DECODE (column_id,cnt, '',','),
                                                         '(' || data_length || ')' || DECODE (nullable,'N', CHR (9) || 'NOT NULL')
                                                      || DECODE (column_id,cnt, '',',')
                                                     ), '
           '
                                          ),0) || CHR (10)
           || ');'
      FROM (SELECT table_name, column_name, data_type, data_length,
                   data_precision, data_scale, column_id, nullable,
                   COUNT (*) OVER (PARTITION BY table_name) cnt
              FROM user_tab_columns)
     WHERE  column_id = cnt
START WITH column_id = 1
CONNECT BY PRIOR column_id + 1 = column_id AND PRIOR table_name = table_name;
select 'spool off' from dual;

spool off;

set VERIFY on;
set WRAP on;
set heading on;
set feedback on;
set termout on;
set echo on;