niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
Converting CHAR to VARCHAR2
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Rauf Sarwar
*nix forums Guru


Joined: 03 May 2005
Posts: 353

PostPosted: Mon Feb 07, 2005 8:51 am    Post subject: Re: Converting CHAR to VARCHAR2 Reply with quote

Zephyr wrote:
Quote:
Hi,

I've inherited a database schema of Oracle 9i with some
char columns that can't be used from a GUI interface.

I need to convert these columns from char (5) to varchar2 (5).
OK, i can drop the constraints create new tables with the rigth
datatype, insert the tuples ... correct the old table and
erverything back.

Is there a possible other solution the convert the datatypes in an
easy way.

Thanks
Patrick

1) Drop indexes.
2) alter table table_name modify (column_name varchar2(5));
3) Remove right padding from the values that were created by char.
update table_name set column_name = rtrim(column_name);
4) Recreate indexes.

Regards
/Rauf
Back to top
Zephyr
*nix forums beginner


Joined: 27 Jun 2005
Posts: 10

PostPosted: Mon Feb 07, 2005 7:39 am    Post subject: Converting CHAR to VARCHAR2 Reply with quote

Hi,

I've inherited a database schema of Oracle 9i with some
char columns that can't be used from a GUI interface.

I need to convert these columns from char (5) to varchar2 (5).
OK, i can drop the constraints create new tables with the rigth
datatype, insert the tuples ... correct the old table and erverything back.

Is there a possible other solution the convert the datatypes in an easy way.

Thanks
Patrick
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 3:41 am | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts How do I render JPEG Data stored in char* buffer? On the Sparrow C++ 2 Thu Jul 20, 2006 8:44 pm
No new posts const char as class member markww C++ 3 Thu Jul 20, 2006 7:55 pm
No new posts converting array values to monomaniac21 PHP 11 Thu Jul 20, 2006 10:17 am
No new posts int & char c language C 5 Thu Jul 20, 2006 2:30 am
No new posts int and char? c language C++ 2 Thu Jul 20, 2006 2:29 am

Buy Anything On eBay | Movies download | Debt Consolidation | Looking for Credit Cards? | Modded Xbox
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1505s ][ Queries: 20 (0.0659s) ][ GZIP on - Debug on ]