Google Answers Logo
View Question
 
Q: Character datatypes in Oracle ( No Answer,   5 Comments )
Question  
Subject: Character datatypes in Oracle
Category: Computers > Programming
Asked by: lhb-ga
List Price: $5.00
Posted: 01 Dec 2005 09:34 PST
Expires: 26 Dec 2005 19:16 PST
Question ID: 600071
I have a problem with varchar2 in oracle.

First I declared a column using CHAR(1)
STATUS CHAR(1)
Then later I alter that collumn to VARCHAR2(10). 

Now, everytime I insert new value to the column, it always right-pad
with space to lenght 10. I am sure that the column data type is
VARCHAR2(10) and it should not have this problem since VARCHAR2 stores
variable-lenght character string.

Is it suppose to hapen when I alter column from CHAR(1) to
VARCHAR2(10)? what could be wrong here?

Thanks
lhb
Answer  
There is no answer at this time.

Comments  
Subject: Re: Character datatypes in Oracle
From: scubajim-ga on 01 Dec 2005 10:37 PST
 
in sqlplus type desc thetablename
What does the definition say?
Subject: Re: Character datatypes in Oracle
From: lhb-ga on 01 Dec 2005 11:10 PST
 
it says VARCHAR2(10)
Subject: Re: Character datatypes in Oracle
From: chivas314159-ga on 04 Dec 2005 09:47 PST
 
Please state your database version and OS.
For example: I have a 9.2.0.6 Oracle Database running on SuSE Linux 9.
Subject: Re: Character datatypes in Oracle
From: chivas314159-ga on 04 Dec 2005 09:53 PST
 
... Also state how you insert a new record.
Subject: Re: Character datatypes in Oracle
From: observer_ip-ga on 24 Dec 2005 16:11 PST
 
Please run below test on you database and provide results. Generally
use of "dump" is the best way to debug column content.

Database: 9.2.0.1

SQL> create table x ( c char(1) );

Table created.

SQL> insert into x values ( 'x' );

1 row created.

SQL> commit;

Commit complete.

SQL> alter table x modify c varchar2(10);

Table altered.

SQL> select dump(c) from x;

DUMP(C)
--------------------------------------------------------------------------------
Typ=1 Len=1: 120

SQL>

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy