Rename table name in Oracle Syntax

Rename table name in Oracle Syntax

We need to rename the old table with new name in Oracle with following syntax:

Syntax

ALTER TABLE table_name RENAME TO new_table_name;

Example

ALTER TABLE tran RENAME TO tran_new;

Note: You can login with the schema name inwhich you want to rename the table.

Suppose my table in SCOTT schema then i login with SCOTT schema and run the following SQL

sqlplus scott/tiger
ALTER TABLE scott.tran RENAME TO tran_new;

It will give the error if you want to execute it like

ALTER TABLE scott.tiger RENAME to scott.tran_new;

Use it as:
sqlplus scott/tiger
ALTER TABLE scott.tran RENAME TO tran_new;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.