Home » RDBMS Server » Server Administration » alter column type !
alter column type ! [message #171539] Wed, 10 May 2006 06:45 Go to next message
ozmartin
Messages: 7
Registered: March 2006
Location: MILANO
Junior Member
Please,I need help! How can i change column type in a table with rows from number to varchar2 in oracle9 ?
Re: alter column type ! [message #171549 is a reply to message #171539] Wed, 10 May 2006 06:55 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member


A workaround

-- Create a table to store the rows temporarily using CTAS.

-- Truncate the original table.

-- Modify the column datatype.

-- Load the data back.




Re: alter column type ! [message #171555 is a reply to message #171549] Wed, 10 May 2006 07:05 Go to previous messageGo to next message
JSI2001
Messages: 1016
Registered: March 2005
Location: Scotland
Senior Member
Or save youself space and time,
create a new column n the existing table, transfer the data from old to new column, drop the old column.

Jim
Re: alter column type ! [message #171559 is a reply to message #171555] Wed, 10 May 2006 07:08 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

Hey! that's a cool way. Cool
Re: alter column type ! [message #171563 is a reply to message #171539] Wed, 10 May 2006 07:15 Go to previous messageGo to next message
gajini
Messages: 262
Registered: January 2006
Senior Member

ALTER TABLE table_name MODIFY column_name VARCHAR2(5);

But the table should be empty.

[Updated on: Wed, 10 May 2006 07:15]

Report message to a moderator

Re: alter column type ! [message #171568 is a reply to message #171563] Wed, 10 May 2006 07:18 Go to previous messageGo to next message
JSI2001
Messages: 1016
Registered: March 2005
Location: Scotland
Senior Member
please clarify. your snippet of info means very little as it has no context.
icon12.gif  Re: alter column type ! [message #171570 is a reply to message #171568] Wed, 10 May 2006 07:23 Go to previous message
ozmartin
Messages: 7
Registered: March 2006
Location: MILANO
Junior Member
Thanks 4 all Jim ! all done Smile)
Previous Topic: ERROR:ORA-04098??
Next Topic: Change to UTF8 character set
Goto Forum:
  


Current Time: Fri Sep 20 10:42:32 CDT 2024