Re: LENGTH function and trailing spaces
Posted in 1995
Kirk Bradley (kbradley@130.35.1.6) wrote: : Sorry.. I didn't mean the dictionary length. I meant the length for each : row. i.e. the length of a column as stored on disk. If I store 'KIRK ' : and 'KIRK' I'd expect length(name) to give me 4 in both cases (cause : it ignores trailing spaces) but I'd like to know if there is a SQL : expression I can use to return 5 and 4. i.e. the length I would get : if I fetched this column into a C program. Hmmm... I don't see a response to this yet... strange... The length of the column as stored on disk is the same as the dictionary length, if you're talking about CHAR type. If you define your column as CHAR(10), both 'KIRK' and 'KIRK ' are stored as 'KIRK '. On disk, they're both stored with a length of 10. length(colname) will return 4 on both. In other words, they are the same. If you define the column as VARCHAR, then both 'KIRK' and 'KIRK ' are stored as 'KIRK', and take up 4 bytes on disk (plus one for the length). length(colname) will return 4 on both. In other words, they are the same. I believe there is a way to get 'KIRK ' into a VARCHAR, and have length return 5, but I don't remember how. Maybe when you LOAD it? : Kirk Bradley : Oracle Corporation Hey, should I be answering questions for someone from Oracle? ;-) June ---- June Tong Informix Asia/Pacific ---- ---- On-Loan Engineer Singapore ---- ---- junet@informix.com (65) 298-1716 ----