Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: CHAR field type - always spaces?
Oracle 6 CHAR is varying, Oracle 7 CHAR is fixed length. No it will always be
padded.
Your code can have disadvantages though. If field_name is indexed, the
function to trim it, will preclude using indexes. I wouldn't use CHAR unless I
am dead sure the length is fixed (like 'M' and 'F' for male and female).
Regards,
Sybrand Bakker, Oracle DBA
Peter Shaw wrote:
> In my experience, when quering on a CHAR field type, this search is much
> faster:
>
> FIELD_NAME = 'sample '
>
> (pad the criteria with spaces to equal the field length) than this search:
>
> TrimRight(FIELD_NAME) ='sample'
>
> But someone told me recently that you cannot always assume that CHAR field
> types will be padded with spaces. I have never found a case that this is
> not true.. Is this right? Feedback?
Received on Sun Nov 08 1998 - 01:14:37 CST