Home » RDBMS Server » Server Administration » RENAME a table? Is it possible?
RENAME a table? Is it possible? [message #60503] Wed, 11 February 2004 05:47 Go to next message
Patrick Tahiri
Messages: 119
Registered: January 2004
Senior Member
Hi,

Is it possible in Oracle 8i to RENAME a table?

Something like:

ALTER TABLE tbl_name RENAME table_new_name; 

??

If yes, what happens to the depending objects (Indexes, Triggers, Constraints)?

I'm looking in my Oracle books and documentation but I can't find anything about it (just about renaming a column)!

Thank you for your help!

Regards,

Patrick Tahiri.
Re: RENAME a table? Is it possible? [message #60506 is a reply to message #60503] Wed, 11 February 2004 06:26 Go to previous messageGo to next message
Thiru
Messages: 1089
Registered: May 2002
Senior Member
Are you sure ? , the following is there in the 8i doc

"
Rename a Database Object Example
To change the name of table dept to emp_dept, issue the following statement:

RENAME dept TO emp_dept;

"

Do you want to try out its effect on indexes,constraints and triggers , just as an exercise ?

-Thiru
Re: RENAME a table? Is it possible? [message #60507 is a reply to message #60506] Wed, 11 February 2004 06:48 Go to previous messageGo to next message
Patrick Tahiri
Messages: 119
Registered: January 2004
Senior Member
Hi Thiru!

So kinf of you!
No, I was asking if it was the correct syntax to RENAME a table! And it was aparently not!

I will then try the RENAME command:
RENAME table_name TO table_new_name;

I will test it with some constraints, indexes and triggers just to see the effects on such an operation!

Again, many thanks!

Regards,

Patrick Tahiri.
Re: RENAME a table? Is it possible? [message #60546 is a reply to message #60507] Fri, 13 February 2004 05:52 Go to previous messageGo to next message
Sunil
Messages: 132
Registered: September 1999
Senior Member
You may also try

ALTER TABLE X RENAME TO Y
Re: RENAME a table? Is it possible? [message #60567 is a reply to message #60507] Mon, 16 February 2004 11:43 Go to previous message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
In fact when you rename a table, ONLY the table will get renamed ... All other objects related to it will NOT get renamed.

To rename the index do:

alter index old_index rename to new_index;

--
Sanjay
Previous Topic: Replication
Next Topic: Trigger that fires when rollback segment error happens
Goto Forum:
  


Current Time: Fri Sep 20 10:47:54 CDT 2024