How to add new column in the existing table at our desired location?

Questions by vijay.akki

Showing Answers 1 - 27 of 27 Answers

 You cannot do this. You can drop and re-create the table if you insist on the columns being in a particular order. Having the columns in a particular order is pretty much pointless. This question is asked on a regular basis. If you had searched, you should have quite quickly discovered this information.

Alter Table<Tab_Name> add column <column_name> .. this is allowed in 9i, but when the table fill with data and various constraint then it might not work..

and order of the column in a RDBMS is not at all important as per Codd's rules, any time you can extract any column in any sequesnce.

Dinesh

Syntax : - Alter Table <table_name> ADD Column (<column_name1> <data_type1>[size1], <column_name2> <data_type2>[size2], ...);

Example : - Alter Table Employee ADD Column (Address2 Varchar2(28),Phone2 Number(6));

  Was this answer useful?  Yes

fkhalid

  • Apr 1st, 2009
 

You can't add the column at desired location but you can create view and put the desired columns in order you required and use that view.

  Was this answer useful?  Yes

You cannot have user defined syntaxes in Oracle, still it is implemented, following error will be thrown.

 1* alter table employee add (age number(10)) after ename
SQL> /
alter table employee add (age number(10)) after ename
                                         *
ERROR at line 1:
ORA-01735: invalid ALTER TABLE option

panwar_5

  • Jan 7th, 2011
 

This can be done eaisly using the keyword after,suppose you want to add a column "name" after the field "id".


Alter table emp add name varchar2 after id


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions