Re: Difference between CHAR vs VARCHAR

From: Volker Hauswurz <VHAUSWUR_at_Materna.DE>
Date: 1995/07/28
Message-ID: <VHAUSWUR.36.3018D8C8_at_Materna.DE>#1/1


In article <gbrown-2707951632190001_at_browng.partech.com> gbrown_at_partech.com (George Brown) writes:
>From: gbrown_at_partech.com (George Brown)
>Subject: Difference between CHAR vs VARCHAR
>Date: Thu, 27 Jul 1995 16:32:19 -0500
 

>What is the difference between CHAR and VARCHAR? I have had some problems
>with queries on CHAR that I had to solve by doing LIKE. I also could not
>develop a Forms 4.0 master-detail application using a CHAR data type
>relation; NUMBER worked fine...
>--
>George Brown Voice: 315-738-0600x250
>8383 Seneca Turnpike FAX: 315-738-8304
>New Hartford, NY 13413-4991 e-mail: george_at_partech.com
> URL: http://www.partech.com

You are right. One of the differences is that CHAR does not work in Forms, even in 4.5. It works if you fill the item completely, e.g. for CHAR(3) it works if you search for 'ABC', it does not work if you search for 'AB', even if you append a blank in FORMS!

I think there are two solutions to solve the problem:

  1. Change all CHAR attributes in your database to VARCHAR2.

If this is not possible

2. In PRE_QUERY add a '%' after the full length of the attribute, e.g. you have a CHAR (3), the input was 'A', you have to fill it up with 2 spaces (which makes CHAR(3)) and append a '%', so have the correct meaning of your search. You cannot simply add a '%' because you would find 'AB', 'AC' and so on....

Good luck
Volker

P.S. The release notes for FORMS 4.0.12 tell you that you cannot call a stored procedure which has a parameter of CHAR type. It is a hint that something does not work right if you have CHAR on the server..., but they don't tell you of the FORMS SELECT problem. Received on Fri Jul 28 1995 - 00:00:00 CEST

Original text of this message