Home » SQL & PL/SQL » SQL & PL/SQL » create table... as select * from ....constraint
create table... as select * from ....constraint [message #242596] Mon, 04 June 2007 04:55 Go to next message
Messages: 3
Registered: May 2007
Location: Hyderabad
Junior Member

I am creating a table like this on oracle 8i.

'create table zzz as select * from yyy;'

But, I want to know how can we create the existing integrity constraints in table yyy on the new table zzz.

Any help appreciated.

Re: create table... as select * from ....constraint [message #242606 is a reply to message #242596] Mon, 04 June 2007 05:40 Go to previous messageGo to next message
Messages: 111
Registered: March 2007
Location: India
Senior Member
When you create a table using the CTAS command, none of the constraints are copied save null/not null. So you will have to manually recreate the constraints after you have created the table.
Re: create table... as select * from ....constraint [message #242869 is a reply to message #242606] Tue, 05 June 2007 06:20 Go to previous message
Messages: 3727
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Time to upgrade. The DBMS_METADATA package will help in 9i+.

Ross Leishman
Previous Topic: How can one see what the previous or next row is without leaving the current record
Next Topic: Unable to fetch data through Oracle Net
Goto Forum:

Current Time: Wed Jul 26 19:58:47 CDT 2017

Total time taken to generate the page: 0.22826 seconds