DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Add a column and rename a column

  1. #1
    Join Date
    Nov 2000
    Posts
    164
    Hi all, I wonder if I can add a column and rename a column to an exisiting table in Oracle 8i. If I can do that, can you please show me how? Many thanks!

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    you can add a column with no problems
    you ca NOT rename a column, you have to drop then add

  3. #3
    Join Date
    Apr 2000
    Location
    Baltimore, MD
    Posts
    759
    AFAIK you cannot rename a column. Confirm this w/ someone. To add a column, use the command:
    alter table table_name add (column_name datatype);

  4. #4
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    Nope! You cannot rename a column, but table in 8i.
    Reddy,Sam

  5. #5
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    take the obj#(object number) from obj$ where name=(your object name)
    then
    update col$ set name=(bla-bla-bla) where
    obj#=(you object number) and name=(the actual column name)
    after commit run the catalog file
    p.s. disable all constraints (and indexes) on that column

  6. #6
    Join Date
    Mar 2001
    Posts
    3
    Originally posted by aracnid
    take the obj#(object number) from obj$ where name=(your object name)
    then
    update col$ set name=(bla-bla-bla) where
    obj#=(you object number) and name=(the actual column name)
    after commit run the catalog file
    p.s. disable all constraints (and indexes) on that column
    I have always been told by Oracle instructors and senior colleagues not to do this, i.e., manually change the data dictionary.

    I guess if you know what you are doing, it should be fine.

  7. #7
    Join Date
    Aug 2000
    Posts
    462
    you can add a column of the appropriate datatype, copy the data from the old column into the new column (use UPDATE), then drop the old column.


  8. #8
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Starting with Oracle 8i Release 3 (8.1.7) you can rename a column with an ALTER TABLE command.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  9. #9
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    aracnid one of my collegue touched data dictionary and messed it up and called Oracle Support, obviously he didnt say he touched the data dictionary but finally somehow the support found out and they simply said

    "since the data dictionary has been modified by customer/user, an action which must not done, us Oracle Support we cant do nothing else but suggest customer/user to rebuild their database"

    Do you think it's really worth to try it?

    This modifying the data dictionary issue was also being discussed the other day in another forum when they were talking about renaming a tablespace by updating ts$

  10. #10
    Join Date
    Oct 2000
    Posts
    123
    Hi, Jmodic,

    What is the syntax.

    Thanks

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