Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: renaming a column

Re: renaming a column

From: Pete Sharman <psharman_at_us.oracle.com>
Date: Thu, 10 Jun 1999 09:12:30 -0700
Message-ID: <375FE3EE.84831EDB@us.oracle.com>


Pascal

Any direct update to the data dictionary that is not one asked for by Support is completely unsupported. If you want to rename a column, you need to either:

  1. Put a view over the top of the table to hide the unwanted name
  2. Create table as select, drop old table, rename (ensure you get all the indexes, grants etc.)
  3. Dump to a flat file, recreate the table, reload.

HTH. Pete

Pascal Byrne wrote:

> DBS: Oracle 8.0.4
> OS: Solaris 2.5.1
>
> Hi All,
>
> I'm trying to write a script to rename a column in a table. The
> following method seemed to work:
>
> obj_num= select obj# from sys.obj$ where type#=2 and name=<old_name> and
> owner# = <userid>;
> update sys.col$ set name=<new_colname> where obj#=obj_num and
> name=<old_colname>;
>
> After running this and restarting the database, 'desc table' reflects
> the changes and DML commands seem to work normally. However when I try
> to create a new type in a PLSQL procedure with '%rowtype' syntax and
> access the new column names, I get an error saying invalid column name.
>
> Is there something else that needs to be updated in addition to (or
> instead of) these tables?
>
> Thanks,
> pascal

--

Regards

Pete


Received on Thu Jun 10 1999 - 11:12:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US