Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename Oracle Table or View

What is the syntax to rename a table or view in Oracle?

like image 902
Steven Avatar asked May 07 '09 15:05

Steven


People also ask

Can we rename a 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.

Can you rename a table in Oracle?

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.

How do I rename a view?

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.

What happens when you rename a table?

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.


1 Answers

ALTER TABLE mytable RENAME TO othertable 

In Oracle 10g also:

RENAME mytable TO othertable 
like image 151
Quassnoi Avatar answered Oct 03 '22 03:10

Quassnoi