Re: LENGTH function and trailing spaces
Posted in 1995
Topics: Data Types & Schema Design
Right.. it gives their DEFINED lengths not the actual
lengths (forVARCHAR 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.
Charles Francis (ancrcs4!ancrcs4!cfrancis@ancrcs3.attmail.com) wrote:
: Table Column Lengths:
: If you want the column lengths for any or all table
: columns in your database just use a simple select.
: The example is for just one table.
: Example:
: select colname,collength from systables, syscolumns
: where systables.tabname = "Table_Name" and
: systables.tabid = syscolumns.tabid
: This select would give the column names and their defined
: lengths. One Note: syscolumns.collength may not give you
: the correct storage length for money and interval data types.
: LIFE CAN BE SIMPLE.
: Chuck Francis
: ----------
: From: ilist
: To: internet!rmy.emory.edu!informix-list
: Subject: Re: LENGTH function and trailing spaces
: Date: Wednesday, April 12, 1995 3:50PM
: Now we're getting somewhere. Can you give me an example then
: of why you'd ever use LENGTH in SQL? Especially since the
: function will not allow an expression? I can't think of
: anything particularly useful that LENGTH can do for me.
: p.s. One reason to havethe REAL length of columns (not
: the stripped length) is to be able to calculate how much
: space a row takes on disk (you have to add in the column,
: row and block overheads of course)
: Kerry Sainsbury (kerry@kcbbs.gen.nz) wrote:
: : In article <3m9he0$3dk@dcsun4.us.oracle.com>,
: : kbradley@130.35.1.6 (Kirk Bradley - Mainframe and Integration
: Technologies)
: wrote:
: : >
: : > Is that clearer? Is it something anybody ever needs/wants to do?
: : I can't imagine why you'd want to do this.
: :
: --------------------------------------,-------------------------------------
: : Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ
: : Quanta Systems, Auckland, New Zealand | kcbbs.gen.nz:/informix/*
: : |
: mathcs.emory.edu:/pub/informix/faq/*
: : +64 9 377-4473 (work) 279-3571 (home) |
: http://www.garpac.com/informix.html
: --
: Kirk Bradley
: Oracle Corporation
: Mainframe and Integration Technologies Group
--
Kirk Bradley
Oracle Corporation
Mainframe and Integration Technologies Group