This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes column name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "column name" Watch "column name" New topic
Author

column name

sunil24
Greenhorn

Joined: Jul 30, 2001
Posts: 5
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

Joined: Mar 06, 2001
Posts: 13459

"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

Joined: Jul 30, 2001
Posts: 5
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

Joined: Jul 30, 2001
Posts: 5
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

Joined: Oct 20, 2001
Posts: 15
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

Joined: Oct 19, 2001
Posts: 9
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

Joined: Dec 06, 2000
Posts: 104
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: column name
 
Similar Threads
SQL server Big Decimal small money hibernate question
about JTable
Hibernate
Parsing the String
Hibernate Is there a corresponding Annotation for <column sql-type="NUMERIC(19,2)"/>