Modify a column data type or size in Oracle

Modifying a column data type or size in Oracle is done by using the constructs below

  1. Changing the column data type:
    ALTER TABLE <Table name>
    MODIFY ( <Column Name> <New data type>)
  2. Changing the size of a column:
    (Assuming the previous data type of column was varchar2 with the length of 20 and it needs to be changed to 10)
    ALTER TABLE <Table name>
    MODIFY ( <Column Name> VARCHAR2(10))
Note: Text within <> indicate the parameters that need to be replaced.

Comments

Popular posts from this blog

Configuring DB2 Connect Server

Concatenate files using MS-DOS