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

Thread: column name

  1. #1
    Join Date
    Apr 2001
    Posts
    10
    How can I change the column name in a table ?

  2. #2
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    simple : you can't !!!
    well, you can't directly, you'll have either to create a temporary table or to create a view on your table ...
    I once heard of ways to do it by playong with the dictionnary, but I would strongly prevent people from playing with that !!

  3. #3
    Join Date
    Feb 2001
    Location
    Bombay,India
    Posts
    530
    Hi,
    U cannot change a column name in a table once it is created.In order to do so U have to drop the column(Ver 8i) or drop the table and recreate it.
    If u are using Oracle8i then u can drop the column and add a new column.
    alter table emp
    drop column comm;

    If u are using Oracle 8 then u have to drop the table and recreate it.

    In case of any help please be free to write to me at rohitsn@altavista.com

    Regards,
    ROhit Nirkhe,Oracle DBA,OCP 8i
    rohitsn@altavista.com

  4. #4
    Join Date
    Apr 2000
    Location
    Baltimore, MD
    Posts
    759
    1. add column to the table
    2. write a procedure using a cursor that would pick data from the old column and insert it in the new column.
    3. set the old column to unused
    4. drop old column
    5. (suggestion) might want to export/import the table to eliminate frag. (if this is a large table) and rebuild indexes if the index contained the old column

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