LENGTH() and VARCHAR
Posted in 1995
>Right.. it gives their DEFINED lengths not the actual
>lengths (for VARCHAR at least) as stored for a given
>row. It sounds like nobody that uses Informix (at least
>on this forum ;-)) uses length() for this purpose and
>so the fact that you can't do this:
> INSERT INTO VT(VARCOLUMN) VALUES ('Kirk ')
> SELECT * FROM VT WHERE LENGTH(VARCOLUMN) = 7
>and have the SELECT return that row.
>Correct?
>p.s. I'm getting this info from the 5.0 SQL ref that says
>that TRAILING SPACES ARE STORED in VARCHAR columns. If
>that isn't true then all bets are off I guess.
--
>Kirk Bradley
>Oracle Corporation
>Mainframe and Integration Technologies Group
Kirk
If you would read a little more you would find that the LENGTH() function
returns the number of bytes in a string after removing trailing spaces.
Also I would not expect the select you give as an example to "return that
row" you inserted. I would expect that many rows might be selected.
Further more if Informix did everything the way Oracle does, there would
not be a need for Oracle. Assuming there is a need for Oracle.
If you don+t like something don+t use it.
Chuck Francis