Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    24

    Unanswered: create table as select *

    I want to create table using create table emp1 as select * from emp where 1=2, but I want the indexes and constraints to be copied from table emp to emp1.

    Thanks
    Srinivas
    Thanks
    Srinivas chityala

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    As far as I can tell, you can not do that using a single CTAS statement. An empty table will be created, but you'll have to create indexes and consstraints separately.

  3. #3
    Join Date
    Aug 2007
    Location
    France
    Posts
    14

    Cool

    Furthermore it will not be possible to have the same indexes and constraints names in the same schema
    If you are in Oracle 9i or more, you can use dbms_metadata.get_ddl(...) to copy/paste the DDL of your indexes and constraints with changing only their names

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •