Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: char, varchar2 confused?

Re: char, varchar2 confused?

From: NetComrade <netcomradeNOSPAM_at_earthlink.net>
Date: Wed, 24 Nov 1999 04:32:07 GMT
Message-ID: <383b69a6.24471313@news.earthlink.net>


It's the other way around.
varchar2(60) allows a string of up to 60 characters, but will only store the actualy amount of characters that you put it (8 for whatever).
char(60) will ad white spaces to anything you put in which is less then 60 characters in length (52 white spaces in your case). You might want to read about RTRIM() function.

and
RTFM. On Wed, 24 Nov 1999 12:29:27 +1100, Sebastian Degenaar <degenaar_at_adlink.com.au> wrote:

>If I do a sql statement within oracle 8i on Win NT on a varchar2 field
>such as
>select * from accounts where account_type = 'whatever' I have to pad the
>'whatever' with spaces to reflect the length of the field. However if I
>change the field type to char, I don't have to pad and it works fine. I
>don't get this.
>
>Any advice greatly appreciated
>
>Cheers!
>
Received on Tue Nov 23 1999 - 22:32:07 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US