How can I generate a DDL script on an existing table in oracle? I am working on a project where I have to re-create some tables that are present in Oracle table into Hive.
解决方案
If your SQL client doesn't support this, then you can use the dbms_metadata package to get the source for nearly everything in your database:
For a table use something like this:
select dbms_metadata.get_ddl('TABLE', 'YOUR_TABLE_NAME')
from dual;
You can also do this for all tables at once:
select dbms_metadata.get_ddl('TABLE', table_name)
from user_tables;
and spool the output into a SQL script.