devxlogo

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

How to Add Multiple Columns to an Oracle Table Using ALTER TABLE

In Oracle, you can use the ALTER TABLE command to add new columns to an existing table—even after it has already been created.

One powerful feature of this command is that it allows you to add multiple columns in a single statement, which can save you time and reduce the amount of code you need to write.

Syntax for Adding Multiple Columns

To add more than one column at a time, you simply enclose all the new column definitions within parentheses and separate them with commas.

Here’s the general structure:

sql
ALTER TABLE table_name
ADD (
column1 datatype,
column2 datatype,
column3 datatype
);

Example

Let’s say you have a table named yourtable, and you want to add the following columns:

  • middle_name (a string of up to 100 characters)

  • hire_date (a date)

  • insurance_id (a number with up to 6 digits)

You can do this in a single statement like so:

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

This command efficiently adds all three columns in one step.


Benefits of Using a Single ALTER TABLE Statement

  • Cleaner code: Reduces repetition and improves readability.

  • Faster execution: Fewer round trips to the database.

  • Easier maintenance: All changes are grouped logically together.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.