RENAME
Week #2: Articles
Learning Outcomes
- Learn how to rename tables.
CREATE
StatementALTER
StatementDROP
StatementRENAME
StatementTRUNCATE
StatementCOMMENT
Statement
RENAME
tables
This section shows you how to rename tables.
Instruction Details →
The RENAME
statement lets you rename database tables, synonyms, and views. You can’t rename object types or change column names. The syntax to rename the supported object is
RENAME employee_view TO employee_v; |
The RENAME
statement can’t be used by a common user to rename an object in another
schema; for example,
SQL> RENAME student.calendar TO student.monthly_calendar; |
raises the following exception:
RENAME student.calendar TO student.monthly_calendar * ERROR at line 1: ORA-01765: specifying owner's name of the table is not allowed |
It’s a useful command to illustrate that the database really keeps track of all objects by their object identifier, not by their name. Table, view, and synonym names are like aliases and are changeable without altering the underlying structure.