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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: V7 VARCHAR2/CHAR usage

Re: V7 VARCHAR2/CHAR usage

From: LONG, Alex <ALONG_at_BAEA.COM.AU>
Date: Mon, 13 Mar 1995 20:33:23 -0500
Message-Id: <9503140147.AA14568@alice.jcc.com>


Greetings Reinhold,

>up to ORACLE V6 there was only a variable-length string datatype (CHAR).
Now
>there is VARCHAR2 and CHAR. For known fixed-length values this might be
an
>improvement in disk usage. On the other hand I now have to consider
>different comparison rules, etc. I was pretty satisfied with one string
>type. Is it worth using two?

>Any opinions or experiences?

I am in the process of converting an application originally written in Informix, converted to Oracle 6, and now Oracle 7.

I would tend to stay away from CHAR datatype unless I really needed a fixed length record, and offhand I can't think of any such use, that I couldn't do with VAARCHAR2.

With CHAR there is an additional "gotcha" is you use the datatype if Forms 4. Because expressions are parsed in a different way from SQL*Plus and Forms, the same statement may work in Plus but not in Forms.

  1. You cannot use a CHAR datatype in a relationship, even when the Master & Detail block's fields are identical.
  2. You cannot use the CHAR datatype in a situation where it is a key or a code, and you wish to select a description or narrative, using that field.

The problem appears to be caused by the trailing blanks. I have tried to compare strings where both were trimmed, and it still wouldn't work

I am now restructuring the tables, changing all the CHAR datatypes to VARCHAR2, and re-selecting the data using LTRIM(RTRIM()) to strip off the trailing spaces.

That is my assessment of it.

Regards
Alex Long along_at_baea.com.au

The usual disclaimers apply, the above is my opinion alone, and does not in any way reflect the opinion or policy of my clients. Received on Mon Mar 13 1995 - 20:47:15 CST

Original text of this message

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