Let’s learn the rename table statement in the Oracle database. This command is used to rename an existing table name to a new name in the database. The new name of the table should be different from the existing table names.
When we rename a table, Oracle invalidates all objects that depend on the old table and all the objects are transferred to the new table.
The syntax for the rename table SQL statement:
SQL> RENAME <existing_table_name> TO <new_table_name>;
For example, we have an existing database table emp. We would like to rename the table name to the new name: employee
SQL> RENAME emp TO employee;
Example: Using existing table name
We cannot use the same name for the new table or any existing table name in the database. We get the following error:
ERROR at line 1:
ORA-00955: name is already used by an existing object
Oracle Database Tutorials on this website:
More information about Oracle Database: