简体   繁体   中英

In Oracle, how do I create the “CREATE TABLE…” syntax for an existing table?

SQL Server has a way to let you "export" an existing table's schema, in the form of its necessary SQL "Create Table" commands.

How do you do this in Oracle? Is there a nice automated way of doing it?

Using a tool like SQL Developer or Toad is probably simplest. But the information is all available in the data dictionary. In particular, check the documentation for DBMS_METADATA.get_ddl. Something like

select dbms_metadata.get_ddl ('TABLE',myschema,mytab) from dual; 

should do what you want.

You can use SQLDeveloper for this. It is freely available and you can just right click on the table and can export the DDL query,export data in various format,etc.

Below is the link to sample Export HOW-To http://www.oracle.com/technology/products/database/sql_developer/howtos/export_intro.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM