Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Determining char/varchar2 column length

Re: Determining char/varchar2 column length

From: Tanel Põder <tanel.poder.003_at_mail.ee>
Date: Thu, 15 Jul 2004 00:45:00 +0300
Message-ID: <00ed01c469eb$d187de70$63a423d5@porgand>


> 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_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Wed Jul 14 2004 - 16:41:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US