Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Rename table
"Christopher Latta" <nobody_at_nowhere.not> a écrit dans le message news:
PVHM6.2839$mA4.82311_at_ozemail.com.au...
> I don't think you can rename a table. There are probably a few approaches
> that will achieve the result you want:
>
> 1. Create a complete new table with the name/structure you want. Assuming
it
> has the same structure, you can populate it with the following SQL:
> insert into newtable (select * from oldtable)
>
> and then drop the oldtable.
>
> 2. Create a view of the table with the new name that you want:
> create view newname (field1, field2, ..., fieldn) as
> select * from oldtable
>
> 3. Create a synonym for the table:
> create public synonym newname for oldtable
>
> Leave out the "public" if you only want the name for that schema.
>
> 4. Maybe you could do something with a stored procedure or function to do
> what you want.
>
> HTH,
> Christopher Latta
>
Oracle provide a 'rename' command on all usual data base objets (tables,
schemas, view...). It's syntax is simply RENAME old TO new.
Regards.
> zifeng li <zifeng.li_at_compudigm.co.nz> wrote in message
> news:3B033FB5.79BA9568_at_compudigm.co.nz...
> > How to rename a table? Thanks. Zifeng
> >
>
>
Received on Thu May 17 2001 - 07:13:55 CDT
![]() |
![]() |