What is the syntax to rename a table or view in Oracle?
+12
A:
ALTER TABLE mytable RENAME TO othertable
In Oracle 10g
also:
RENAME mytable TO othertable
Quassnoi
2009-05-07 15:39:29
+2
A:
In order to rename a table in a different schema, try:
ALTER TABLE owner.mytable RENAME TO othertable;
The rename command (as in "rename mytable to othertable
") only supports renaming a table in the same schema.
Pop
2009-05-07 16:42:26
+4
A:
To rename a table you can use:
RENAME mytable TO othertable;
or
ALTER TABLE mytable RENAME TO othertable;
or, if owned by another schema:
ALTER TABLE owner.mytable RENAME TO othertable;
Interestingly, ALTER VIEW does not support renaming a view. You can, however:
RENAME myview TO otherview;
The RENAME command works for tables, views, sequences and private synonyms, for your own schema only.
If the view is not in your schema, you can recompile the view with the new name and then drop the old view.
(tested in Oracle 10g)
Jeffrey Kemp
2009-05-08 03:36:12
+1
A:
One can rename indexes the same way
alter index *owner.index_name* rename to *new_name*;
Maurício
2009-11-12 13:23:36