tags:

views:

44

answers:

2

I have a table called W_US and i want to create W_UK in oracle with same schema as for W_US.

A: 

It sounds like you want to create a table called W_UK that has the same columns and types as W_US. You could do the following:

create table W_UK as 
select *
  from W_US
 where 1 = 2;
Dougman
That will create a table with the same columns specifications: names, data types, and null/not null. It won't create any other constraints (check, foreign key, primary key, unique), grants, triggers, or other indexes. If you need to make a new table exactly like it, look up the DBMS_METADATA.GET_DDL function to get the DDL to transform it to your liking.
Adam Musch
A: 

These sort of questions are a warning flag, because the obvious solution is to clone the CREATE TABLE script for W_US (through the magic of 'Save as ...') and edit the clone so it creates W_UK.

The fact that this avenue appears to be closed to you suggests that you do not have your DDL statements under source control. This is a bad state of affairs. All our code should be under source control, including the scripts which build the database schema.

APC