Syntax for alter columns in a existing table in Oracle

Syntax for add, drop, rename column in the Oracle table

Add column in the existing table

alter table scott.emp add( empname varchar2(20));
alter table scott.emp add( empid number, deptid number);

Drop column in the existing table

alter table scott.emp drop (empname);
alter table scott.emp drop (empid, deptid);

Rename the column in the table

alter table scott.emp rename column empname to empname_new;

Set column unused in the table

alter table scott.emp set unused (empname);

Drop unused columns from a table

alter table scott.emp drop unused columns;

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 )

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.