Exforsys
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Rename column name

This is a discussion on Rename column name within the Oracle Database forums, part of the Database category; How can I change the name of the column ? and in big sized database design if I change the ...

  1. #1
    jyaseena is offline Junior Member Array
    Join Date
    Aug 2005
    Answers
    8

    Rename column name

    How can I change the name of the column ? and in big sized database design if I change the name of the column How can we solve this cumbersome task..?


  2. #2
    anwar_s1 is offline Junior Member Array
    Join Date
    Apr 2007
    Answers
    2

    Solution

    Quote Originally Posted by jyaseena View Post
    How can I change the name of the column ? and in big sized database design if I change the name of the column How can we solve this cumbersome task..?
    First:


    Alter table <tablename>

    drop column <columnname>

    Second:

    Alter table <tablename>
    add(<columnname> <datatype>)


  3. #3
    jyaseena is offline Junior Member Array
    Join Date
    Aug 2005
    Answers
    8
    dear friend

    my question is to change the name of COLUMN , not the name of Table..


  4. #4
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    You can rename a column in a table as follows:

    ALTER TABLE tablename RENAME COLUMN oldcolumn TO newcolumn;

    I would suggest that you must be careful and assured while designing the database itself regarding these. Only if it is very essential go for this process now.


  5. #5
    Adrian is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124
    You can also rename by adding a column with a new name and dropping old columns. This can be done as below:

    alter table t1 add ( newcolame datatype );
    update t1 set newcolname=oldcolname;
    alter table t1 drop column oldcolname;

    Try as suggested and let us know the result.


  6. #6
    jyaseena is offline Junior Member Array
    Join Date
    Aug 2005
    Answers
    8

    Error comeing...!!

    Quote Originally Posted by cyrus View Post
    You can rename a column in a table as follows:

    ALTER TABLE tablename RENAME COLUMN oldcolumn TO newcolumn;

    I would suggest that you must be careful and assured while designing the database itself regarding these. Only if it is very essential go for this process now.
    I used above command but there is error message as below

    ORA-14155:Missing partition or SUBPARTITION keyword


  7. #7
    jyaseena is offline Junior Member Array
    Join Date
    Aug 2005
    Answers
    8

    No One To Help Me...!!!!!

    Quote Originally Posted by jyaseena View Post
    I used above command but there is error message as below

    ORA-14155:Missing partition or SUBPARTITION keyword
    no one to help me please....!!!!


  8. #8
    anilkumar2010's Avatar
    anilkumar2010 is offline know nothing Array
    Join Date
    Oct 2011
    Location
    amerpet
    Answers
    7
    all answers will be same but sum are essential


  9. #9
    srkslm is offline Junior Member Array
    Join Date
    Feb 2012
    Answers
    1
    but be sure the column should not contain values.


  10. #10
    sonu1049 is offline Junior Member Array
    Join Date
    Sep 2011
    Answers
    1
    alter table tablename rename column columnname to newname;


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...