Alter table drop column Oracle

alter table modify column oracle example

Hello friends, In this article, we are going to discuss, how to use the ALTER TABLE ORACLE MODIFY column. Using this command we can modify table structure if required after table creation.

Alter Table Oracle Modify

In this practical, we are using the following table which has three columns.

SQL> desc ocptech;

  Name          Null?    Type
 ------------  ------   ----------
 ID                            NUMBER
 DETAILS                  VARCHAR2(60)
 J_DATE                    DATE

Modify Column

Suppose, I want to change the datatype of DETAILS columns in the above table, so we are using the following query.

SQL> alter table ocptech modify details number;

 Table altered.

Now check the table structure, it is changed.

SQL> desc ocptech;

 Name          Null?    Type
----------  --------   --------
 ID                      NUMBER
 DETAILS                 NUMBER
 J_DATE                  DATE

Alter table Add Column

Using the alter command we can add or remove columns from the table, using the following query we can add a new column in the ocptech table.

SQL> alter table ocptech add xyz number;

Alter table Drop Column

As we discuss above, Using the following query we can remove a column.

SQL> alter table ocptech drop column xyz;

Table altered.
subscribe on youtube

Read - What is SQL, DBMS, and RDBMS

One thought on “Alter table drop column Oracle

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top