What is the syntax to rename a table or view in Oracle?
Use the RENAME statement to rename a table, view, sequence, or private synonym. Oracle Database automatically transfers integrity constraints, indexes, and grants on the old object to the new object.
RENAME TABLE allows you to rename an existing table in any schema (except the schema SYS). To rename a table, you must either be the database owner or the table owner.
In Object Explorer, expand the database that contains the view you wish to rename and then expand the View folder. Right-click the view you wish to rename and select Rename. Enter the view's new name.
When you rename a table, Oracle automatically transfers indexes, constraints, and grants on the old table to the new one. In addition, it invalidates all objects that depend on the renamed table such as views, stored procedures, function, and synonyms.
ALTER TABLE mytable RENAME TO othertable
In Oracle 10g
also:
RENAME mytable TO othertable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With