Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: SQL
Expertise: Beginner
Mar 6, 2017

Add Multiple Columns to a Table in a Single Statement in Oracle SQL

In Oracle, you can use the ALTER TABLE command to add columns to a table after it's created.

The command also allows you to add multiple columns in the one statement.

The way to do this is to enclose all of the columns in brackets and separate the columns by a comma.

For example:

ALTER TABLE yourtable
  middle_name VARCHAR2(100),
  hire_date DATE,
  insurance_id NUMBER(6)

This means all the columns will be added in a single statement, reducing the amount of code you'll need to write.

Ben Brumm
Thanks for your registration, follow us on our social networks to keep up-to-date