Re: Determining char/varchar2 column length

  • From: Tanel Põder <tanel.poder.003@xxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 15 Jul 2004 00:45:00 +0300

> SQL> select column_name, data_length, char_length, char_col_decl_length
> from all_tab_columns where table_name = 'FOO';
>
> COLUMN_NAME                    DATA_LENGTH CHAR_LENGTH
CHAR_COL_DECL_LENGTH
> ------------------------------ ----------- ----------- -------------------
-
> A                                       50          50
50
> B                                      150          50
150
>
> I would have expected char_col_decl_length to be the same for both
columns.

So you want to see how many *characters* a column was defined to hold,
despite the details how many bytes a char takes in it's charset?

What about:

select column_name,
       nls_charset_decl_len(data_length, nls_charset_id(character_set_name))
decl_char_len
from dba_tab_columns where table_name = 'T123';

Tanel.


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: