Re: RE: Get max length of data for a column
Norman Dunbar <[email protected]>
| Newsgroups | gmane.comp.db.oracle.toad.free |
|---|---|
| Message-ID | <[email protected]> |
Morning Mike,
> Thanks for that clarification. To be honest, we don't really use CHAR here
> anymore, which is why I've either forgotten that important piece of
> information, or (worse) never knew it.
Years ago, I wrote a "data obfuscation" routine with simply replaced
certain columns with random data generated by DBMS_RANDOM. All my CHAR
columns ended up being exactly the defined length! That's when I noticed
it. I ended up using VSIZE() to get the length of the TRIM()med CHAR
columns. Sort of stuck in my "cache" since then.
> Out of interest, is there any reason
> why one would want to use CHAR rather than VARCHAR?
I'm not sure. I use them occasionally myself. Just for internal space
saving. A VARCHAR2 has a hidden size setting. If the column is 100 long
and you store 40 in it, there's a counter internally that says "this is
how long the data is". Not a great reason, but if you have flag columns
- gender, for example, that are only one character long, you don't need
the counter internally.
There are probably other good reasons for using CHAR, but I can't think
of any off hand. Maybe Bert knows - he knows lots of good stuff!
--
Cheers,
Norm. [TeamT]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/toad/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/toad/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/