DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: create table without constraints

  1. #11
    Join Date
    Jun 2005
    Location
    London, UK
    Posts
    159
    Possibly modifying the columns as NULL might be a simpler approach than looking up the system names of the NOT NULL constraints and disabling them:

    Code:
    SQL> CREATE TABLE testit (col1 INT NOT NULL, col2 INT NOT NULL);
    
    Table created.
    
    SQL> set lines 50
    SQL> desc testit
     Name                    Null?    Type
     ----------------------- -------- ----------------
     COL1                    NOT NULL NUMBER(38)
     COL2                    NOT NULL NUMBER(38)
    
    SQL> ALTER TABLE testit
      2  MODIFY (col1 NULL, col2 NULL);
    
    Table altered.
    
    SQL> desc testit
     Name                    Null?    Type
     ----------------------- -------- ----------------
     COL1                             NUMBER(38)
     COL2                             NUMBER(38)
    
    SQL>

  2. #12
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    You can override the not null constraint creation easily enough by just listing the column names with a "null" after them ...
    Code:
    drop table t1;
    drop table t2;
    create table t1 (col1 number not null);
    insert into t1 values (1);
    create table t2 (col1 null) as select * from t1;
    desc t2
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

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


Click Here to Expand Forum to Full Width