Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I add more than one column to a table using SQL?

843854Dec 27 2002 — edited Dec 28 2002
Hi

I need to add 3 columns to a table using SQL

the syntax
"ALTER TABLE TEST ADD COLUMN newcol1 float";

works fine - for adding one coumn only.
For multiple columns I tried various permutations along the lines of

"ALTER TABLE TEST ADD (COLUMN newcol01 float, COLUMN new2 float,COLUMN new3 float)";

"ALTER TABLE TIPSTEST ADD COLUMN new1 float"
"ALTER TABLE TIPSTEST ADD COLUMN new2 float"
"ALTER TABLE TIPSTEST ADD COLUMN new3 float"

etc., but this doesn't work.

From a web search it sounds like SQL can only add one column at a time.

I have a workaround : create intermediate temporary tables , copying data and adding
one column at each stage. It seems a fairly awkward way of programming though.

Am I missing something simple : is there a way to add multiple columns in one go?


Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 25 2003
Added on Dec 27 2002
4 comments
1,040 views