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.
More details are in the manual: http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_metada.htm