开发者

In Oracle, how do I create the "CREATE TABLE..." syntax for an existing table?

开发者 https://www.devze.com 2022-12-12 13:36 出处:网络
SQL Server has a way to let you \"export\" an existing table\'s schema, in the form of its nec开发者_运维技巧essary SQL \"Create Table\" commands.

SQL Server has a way to let you "export" an existing table's schema, in the form of its nec开发者_运维技巧essary SQL "Create Table" commands.

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


SQL Server parallels to Oracle DBMS_METADATA.GET_DDL?

Gives a good example.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号