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 Martin,
(Sorry, afternoon already!)
> I *thought* VARCHAR2 was varying size based on a Run Length Encoding for
> the column where CHAR was always fixed length
Varchar2 stores only the data it was given, so, inserting '1234H' and
'123 ' into a varchar results in 5 and 4 used characters respectively,
regardless of the column's definition.
Inserting the above two values into a CHAR(10) column would result in
exactly 10 characters being stored, each value iw space filled on the
right to the column width.
> to acquire column length the path of least resistance is to take the
> length from USER_TAB_COLUMNS e.g.
> SQL> select DATA_LENGTH from USER_TAB_COLUMNS where table_name='USER$'
> AND COLUMN_NAME='PASSWORD';
Nope, won't worl. DATA_LENGTH is how the column was defined,
VARCHAR2(10) and CHAR(15) will always give you 10 and 15. The OP was
after the size of the data in the columns, not the maximum size it can be.
> Norm or Bert does this conform to your understanding?
See above.
--
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/