Subject | Re: [firebird-support] blank character |
---|---|
Author | Ann Harrison |
Post date | 2011-05-09T15:09:35Z |
On Sun, May 8, 2011 at 3:04 PM, Olaf Kluge <olaf.kluge@...> wrote:
significant characters and trailing blanks are considered
insignificant. Even using
CHAR, you'll find that 'ABC ' is the same as 'ABC' - the SQL
standard specifies
that when comparing CHAR or VARCHAR values the shorter value will be extended
with blanks to the length of the longer.
If you want blanks saved consistently, use CHAR. It won't make any difference
on disk because run-length compression will eliminate the blanks, but for
your application and for transferring data, using CHAR will appear to preserve
trailing spaces.
Good luck,
Ann
> If I take a char(40)-field, the blanks were automatically saved, or not? IfThe difference between CHAR and VARCHAR is that VARCHAR saves only the
> the ERP-System read the table, the blanks are present. With varchar your
> idea was very good, but it is easier with char. When I read the char-values
> and save it in my varchar-fields (other internal table), the blanks should
> not be saved.
>
>
> CREATE PROCEDURE U_VC_TO_A (
> VC_IN VARCHAR (40),
> STELLEN INTEGER)
> RETURNS (
> A_OUT VARCHAR (40))
> AS/**/
significant characters and trailing blanks are considered
insignificant. Even using
CHAR, you'll find that 'ABC ' is the same as 'ABC' - the SQL
standard specifies
that when comparing CHAR or VARCHAR values the shorter value will be extended
with blanks to the length of the longer.
If you want blanks saved consistently, use CHAR. It won't make any difference
on disk because run-length compression will eliminate the blanks, but for
your application and for transferring data, using CHAR will appear to preserve
trailing spaces.
Good luck,
Ann