[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Difference between ALL_TAB_COLUMNS: DATA_LENGTH and CHAR_LENGTH

Posted on 2006-11-04
5
Medium Priority
?
6,553 Views
Last Modified: 2012-05-05
What is the difference between the DATA_LENGTH column and the CHAR_LENGTH column of the data dictionary
ALL_TAB_COLUMNS? ?

0
Comment
Question by:aman_greval
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 17875153
Hi,

most of the time they are going to be the same,

Data_Length is the length of the column in bytes - Char_Length is the length of the column in characters.

Both will not necessarily be poplulated,

please refer to the official documentation (have used 10g here) for the meaning of everything in this data dictionary
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2094.htm#sthref1695
0
 
LVL 6

Accepted Solution

by:
DLyall earned 1000 total points
ID: 17876007
For example, a column type of VARCHAR(20) wiil have a character_length of 20 and a data_length of 20.
A column of type NUMBER will have a data_length of 22 but no character_length value.
A column of type ROWID will have a data_length 10 but no character_length.

It depends on the column type.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 17880626
using Unicode a character may reside in more then 1 byte (by AL32UTF8 - up to 4 bytes).
There are two possibilities to define an VARCHAR2 column:

name VARCHAR2(20 byte);
name VARCHAR2(20 char);

The first is measured in bytes. It can not be longer then 20 bytes
The second is measured in characters - it can be long up to 8 bytes:  20 characters every 4 bytes ---->  80 bytes.
So it depends how you define the field.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17943605
how was my decision (Raynard7) and that of schwertner wrong?
0
 

Author Comment

by:aman_greval
ID: 17944642
Dyall example made the concept very clear to me even on first reading.
Your examples were not wrong.
At the end i suppose, the simple and clear example made all the difference.

For example, a column type of VARCHAR(20) wiil have a character_length of 20 and a data_length of 20.
A column of type NUMBER will have a data_length of 22 but no character_length value.
A column of type ROWID will have a data_length 10 but no character_length.

It depends on the column type.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious sideā€¦
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question