DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: drop a column

  1. #1
    Join Date
    Nov 2000
    Posts
    51
    Hi,

    I want to drop a column, is anyone know the command to drop it?

    Thanks !

  2. #2
    Join Date
    Jun 2000
    Posts
    295
    Drop column only works in Oracle 8i

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    alter table xyz drop column col1;
    Jeff Hunter

  4. #4
    Join Date
    Dec 2000
    Posts
    4
    alter table tablename drop column columnname

  5. #5
    Join Date
    Dec 2000
    Posts
    10
    That is new feature in Oracle 8i.
    Command: alter table xxx drop column xxx;

  6. #6
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    ALTER TABLE table_name DROP column_name CASCADE CONSTRAINTS ;

    Restrictions on the drop_column_clause:

    Each of the parts of this clause can be specified only once in the statement and cannot be mixed with any other ALTER TABLE clauses. For example, the following statements are not allowed:

    ALTER TABLE t1 DROP COLUMN f1 DROP (f2);
    ALTER TABLE t1 DROP COLUMN f1 SET UNUSED (f2);
    ALTER TABLE t1 DROP (f1) ADD (f2 NUMBER);
    ALTER TABLE t1 SET UNUSED (f3)
    ADD (CONSTRAINT ck1 CHECK (f2 > 0));

    You can drop an object type column only as an entity. Dropping an attribute from an object type column is not allowed.

    You can drop a column from an index-organized table only if it is not a primary key column. The primary key constraint of an index-organized table can never be dropped, so you cannot drop a primary key column even if you have specified CASCADE CONSTRAINTS.

    You can export tables with dropped or unused columns. However, you can import a table only if all the columns specified in the export files are present in the table (that is, none of those columns has been dropped or marked unused). Otherwise, Oracle returns an error.

    You cannot drop a column on which a domain index has been built.

    You cannot use this clause to drop:

    A pseudocolumn, clustered column, or partitioning column. (You can drop nonpartitioning columns from a partitioned table if all the tablespaces where the partitions were created are online and in read-write mode.)

    A column from a nested table, an object table, or a table owned by SYS.

  7. #7
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    [QUOTE][i]Originally posted by sreddy [/i]
    [B]You can export tables with dropped or unused columns. [/B][/QUOTE]

    Of course this should read:
    You can export tables with dropped or unused columns as long as you are not using a direct export (bug 1274582).
    Jeff Hunter

  8. #8
    Join Date
    Jun 2000
    Posts
    295
    Here is link from this site:

    [url]http://www.dbasupport.com/oracle/ora8/page1.shtml[/url]

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