|Oracle9i SQL Reference
Release 2 (9.2)
Part Number A96540-01
SQL Statements: DROP SEQUENCE to ROLLBACK, 17 of 19
RENAME statement to rename a table, view, sequence, or private synonym.
The object must be in your own schema.
Specify the name of an existing table, view, sequence, or private synonym.
Specify the new name to be given to the existing object. The new name must not already be used by another schema object in the same namespace and must follow the rules for naming schema objects.
Restrictions on renaming objects:
The following example uses a copy of the sample table
hr.departments. To change the name of table
emp_departments, issue the following statement:
You cannot use this statement directly to rename columns. However, you can rename a column using the
Another way to rename a column is to use the
RENAME statement together with the
TABLE statement with
subquery. This method is useful is you are changing the structure of a table rather than only renaming a column. The following statements re-create the sample table
hr.job_history, renaming a column from
CREATE TABLE temporary (employee_id, start_date, end_date, job_id, dept_id) AS SELECT employee_id, start_date, end_date, job_id, department_id FROM job_history; DROP TABLE job_history; RENAME temporary TO job_history;