Anantha Krishnan
Anantha Krishnan

Reputation: 3088

Oracle sql developer - export DDL - only create table sql

I want to run unit tests by generating all tables in HSQLDB, present in my oracle database.

For that I want to export all DDL create table statements from oracle tables.

I tried export database, but along with create table sql I am getting lot other SQLs like,

" PARTITION BY RANGE ("CREATION_DATE") " etc.

How do I export all oracle tables(schema) to HSQLDB? is there any better way?

Upvotes: 1

Views: 6702

Answers (2)

Alex Poole
Alex Poole

Reputation: 191570

You can use the DBMS_METADATA.GET_DDL() function to get the table definition, and modify what is included with the SET_TRANSFORM_PARAM() options, specifically in this case the PARTITIONING parameter.

There are lots of examples for you to search for, but here's one that shows the DDL being simplified with similar transformations.

Upvotes: 4

Olaf H
Olaf H

Reputation: 496

It's some work, but you can implement your own tool to create the DDL.

All you need is stored in the Oracle database catalogue.

To create just tables (without index and constraints) you need these 2 tables:

  • USER_TAB_COLUMNS
  • USER_TABLES

You will find a detailed documentation of these tablese here: Oracle Database Reference

Other usefull Oracle tables are

  • USER_CONSTRAINTS
  • USER_INDEXES

Upvotes: 0

Related Questions