Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Get the CREATE TABLE statement from an existing database
On Wed, 20 Jun 2001 13:06:26 GMT, Brian Peasland <oracle_dba_at_qwest.net> wrote:
>The information is there, but you have to put it together yourself. Try
>looking at the following views for starters:
> USER_TABLES, USER_TAB_COLUMNS, USER_CONSTRATAINTS, USER_CONS_COLUMNS,
>USER_INDEXES, USER_IND_COLUMNS
>There is no one singular table or view which will give you all the
>information that you seek.
>
In 9i it is possible to select the DDL for a table, or most other
objects, very easily. Something along the lines of:
select get_ddl(TABLE)
from user_tables
where table_name = foo
Syntax may be a bit off but it's as simple as that, and it comes out with all the storage, partitioning, sub-partitioning etc. clauses. I know the original poster probably isn't using 9i and it's not the best reason I've heard to upgrade but I just thought it was worth mentioning ;-) Received on Sun Jun 24 2001 - 16:44:36 CDT