• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

column name

 
sunil24
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,
I have one small prob.
Can i chage column name of table in oracle.
if it is possible, how?
sunil
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sunil24",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
David O'Meara
 
sunil24
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,
Next time i will log with full name.
but waht ab ans of this question.
I want it urgent.
pl reply,
sunil
 
sunil24
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,
Next time i will log with full name.
but waht ab ans of this question.
I want it urgent.
pl reply,
sunil
 
kshitij raval
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all adding a new column to the table:
alter table tableName add newFieldName newFieldType(size);
Then populating this new column with old column which we want to delete:
update table tableName set newFieldName = oldFieldName;
Then finally, delete the old column:
alter table tableName drop column oldFieldName;
Example,
alter table test add fldnew varchar(40);
update table test set fldnew=fld;
alter table test drop column fld;
with regards,
Kshitij Raval

[This message has been edited by kshitij raval (edited October 22, 2001).]
 
sundari swamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kshitij raval:
First of all adding a new column to the table:
alter table tableName add newFieldName newFieldType(size);
Then populating this new column with old column which we want to delete:
update table tableName set newFieldName = oldFieldName;
Then finally, delete the old column:
alter table tableName drop column oldFieldName;
Example,
alter table test add fldnew varchar(40);
update table test set fldnew=fld;
alter table test drop column fld;
with regards,
Kshitij Raval

[This message has been edited by kshitij raval (edited October 22, 2001).]

Sunil24 : what version of Oracle are you Using ?
To kshitij raval:
I think this is possible only with Oracle8i. Not on versions lesser than that.
 
Nasser Aboobaker
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Yeah, Sundari is right. In older versions of Oracle you can create another table with your choice of column names and populate it from old table then drop the old table then rename the new table name to old table name.
Nasser
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic