

Where cl.constraint_name=rcn.constraint_name V_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')' ĭbms_output.put_line (v_cname||v_type||v_null||v_virg) ĭbms_output.put_line('- PRIMARY KEYS -') įor rcn in (select table_name,constraint_nameĭbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (') ĭbms_output.put_line ('CONSTRAINT '||rcn.constraint_name) V_type:='NUMBER('||rc.data_precision||')' Įlsif rc.data_type='NUMBER' and rc.data_scale'0' then V_type:='VARCHAR2('||rc.data_length||')' Įlsif rc.data_type='NUMBER' and rc.data_precision is null andĮlsif rc.data_type='NUMBER' and rc.data_scale='0' then Description: Reverse Engineer your existing schema objectsĭbms_output.put_line('- DROP TABLES -') įor rt in (select tname from tab order by tname) loopĭbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS ') ĭbms_output.put_line('- CREATE TABLES -') įor rt in (select table_name from user_tables order by 1) loopĭbms_output.put_line('CREATE TABLE '||v_tname||' (') įor rc in (select table_name,column_name,data_type,data_length,ĭata_precision,data_scale,nullable,column_id

You can add your own clauses and specific stuff, but I believe it's a good starting point. It works only for tables, PKs, FKs, indexes and sequences, because that is what I need now. Please note that this is a very basic script that can HELP you develop your own DDL commands. Since I did not want all clauses to show up at this time, I programmed this. If I want something different, I have to write the code myself. The problem with EXP is that you cannot format the ouput. This is a script I coded to help me get the DDL for my database in order to carry out a "reverse engineering".
