Home » SQL & PL/SQL » SQL & PL/SQL » How can I create a column after a particular column
How can I create a column after a particular column [message #230906] Fri, 13 April 2007 05:07 Go to next message
shyam.2384
Messages: 16
Registered: March 2007
Location: BHILAI
Junior Member
How can I create a column after a particular column??

[Updated on: Fri, 13 April 2007 05:09]

Report message to a moderator

Re: How can I create a column after a particular column [message #230910 is a reply to message #230906] Fri, 13 April 2007 05:23 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
When you add a column to an existing table, the column will be added at the end of the column list. But is this a problem? It is you, the programmer, that indicates the order of the columns in the selects you write.

MHE
Re: How can I create a column after a particular column [message #230980 is a reply to message #230910] Fri, 13 April 2007 11:05 Go to previous messageGo to next message
shyam.2384
Messages: 16
Registered: March 2007
Location: BHILAI
Junior Member
I know that I can select that column in any order but I want to create it after a particular column
then what to do??????????????
Re: How can I create a column after a particular column [message #230994 is a reply to message #230980] Fri, 13 April 2007 11:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In relational model, this question is meaningless: there is no order in columns.
Oracle is R(elational)DBMS, so there is no logically order.
So there is no before or after a column.
So the question is meaningless.

Moreover, as Maarten said, you always have to name columns in statement, so what do you care if a column is "before" or "after"?

Regards
Michel
Re: How can I create a column after a particular column [message #231051 is a reply to message #230994] Fri, 13 April 2007 15:25 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you insist on doing it, first drop the table and then create another one, having columns in an order you prefer.

Don't forget to make a copy of the original table in order to be able to restore table's contents. Also, the whole thing might get complicated if there are (referential integrity) constraints on the table, triggers, grants etc.

Generally speaking, doing that isn't worth a pain.
Re: How can I create a column after a particular column [message #231052 is a reply to message #230980] Fri, 13 April 2007 15:33 Go to previous message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
If one is lazy to write all the column names and want to put an '*' then one can create a view. Cool
Check this.
By
Vamsi
Previous Topic: ORA-01843: not a valid month error
Next Topic: Calculated Fields and formatting
Goto Forum:
  


Current Time: Sun Dec 04 14:45:38 CST 2016

Total time taken to generate the page: 0.04938 seconds