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

Thread: Rename table column ....How ???

  1. #1
    Join Date
    Oct 2000
    Posts
    28
    Hello,
    How I can rename the column of emp table having column name sal to salary ??
    Is this possible ? and If possible wat are the side effects like re-create indexes ,triggers ,constraints ,compile procedures and functions etc......

    Sunil

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    Well you can use alias instead of renaming them if alias is enough for your needs.

  3. #3
    Join Date
    Aug 2000
    Location
    Shanghai
    Posts
    433
    Hi , Pando ,
    Can you explain little bit detail about creating alias
    on the column (because I only know alias can be created
    on the objects like table ) .

    thanks

    ligang


  4. #4
    Join Date
    Oct 2000
    Posts
    28
    Pando,
    I want to just rename the column name from "sal" to "salary" for all purpose . Alias may help at the time of select statement.
    Sunil

  5. #5
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    just do

    select sal "Salary" from emp

  6. #6
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    Only if you know what are you doing:
    Works on 8.*.* and up (UNLEASHED)

    e.s your table is xxx with 2 fields x and y

    as sys user:
    1. select obj# from obj$
    where name='XXX'
    - take the number id (es 1000)

    2. select obj#, col#, name from col$
    where obj#=1000;

    OBJ# COL# NAME
    1000 1 X
    1000 2 Y

    3. update col$ set name='THE_NAME_YOU_WANT'
    where obj#=1000
    and col#=1;

    4. run svrmgrl @$ORACLE_HOME/rdbms/admin/catalog
    @$ORACLE_HOME/rdbms/admin/catproc

    then desc xxx




  7. #7
    Join Date
    Aug 2000
    Location
    Straham NH
    Posts
    73
    aracnid

    Wil that work for droping a column in 8.0.*

    Gary Mazzone


  8. #8
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    NO !!, ON "DELETE COLUMN" WILL NOT WORK, AND WILL DAMAGE YOUR TABLE

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