BC remote Oracle DBA - Call (800) 766-1884  
Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation








EnterpriseDB: CHAR Data Type

Oracle Tips by Burleson Consulting


EnterpriseDB also supports a CHAR data type.  CHAR is a fixed length data type. If you don't specify a size, it defaults to 1.

A fixed length data type always uses all of its declared length.  If you declare a CHAR(50) and assign it a value, it will be padded to 50 characters with spaces.  A VARCHAR2(50) does not pad.  I don't use CHAR very often.  VARCHAR2 is much more useful to me as it only requires storage for characters that are actually used.

To declare a 50-character CHAR variable, you would simply enter the variable name followed by CHAR(50). This variable or column would pad to 50 spaces when you add any data, regardless of the data's size.

For example, if I declare a variable:

v_data CHAR(50);

My variable name is v_data, the data type is CHAR and the declared length is 50.  The actual length stored is 0 characters because the variable is null.  If we assign it a value:

v_data := 'LEWIS';

We gave the variable v_data that value of LEWIS.  LEWIS is 5 characters but our variable now holds 50 characters:  5 characters for LEWIS and 45 spaces.  If v_data had been a VARCHAR2(50), its length would only be 5.

The only benefit of a CHAR to a VARCHAR2 is that you always know exactly how long a CHAR column is going to be.  Either it will be NULL or it will be its declared length.  A VARCHAR2 will always either be NULL or it will be some length less than or equal to its max length.

Synonyms for CHAR are:



In Oracle, a CLOB data type is used to store very large text documents.  In Oracle 10g, on a 64-bit machine, a CLOB can store 128 terabytes of data.  EnterpriseDB does not support the CLOB data type directly.  A CLOB declaration is transformed to the TEXT data type.  A TEXT field can be up to a gigabyte in size.  TEXT works like a VARCHAR2 but without the declared max size.

Synonyms for CLOB are:







If I were to create a table with the text data types that we have discussed, the syntax would look like this:

CREATE TABLE text_table (
  name VARCHAR2(50),
  address CHAR(50),
  comments CLOB

Now that we have a table, we can insert into it:

INSERT INTO text_table (name, address, comments)
  VALUES ('Lewis', 'New Orleans', 'My Name is Lewis and My address is New Orleans.');

If we selected the data back out from the table:

SELECT name, address, comments
  FROM text_table;

I can use EnterpriseDB PSQL (which I spoke about in Chapter 2) to run these commands.

edb=# CREATE TABLE text_table (
edb(#   name VARCHAR2(50),
edb(#   address CHAR(50),
edb(#   comments CLOB
edb(# );
edb=# INSERT INTO text_table (name, address, comments)
edb-#   VALUES ('Lewis', 'New Orleans', 'My Name is Lewis and My address is New
edb=# commit;
edb=# SELECT name, address, comments
edb-#   FROM text_table;

 name  |             address              |                    comments  

-------+----------------------------------+--------------------------------------------- Lewis | New Orleans                      | My Name is Lewis and My address is New Orleans.
(1 row)


I will use PSQL to run commands for the remainder of this chapter.

This is an excerpt from the book "EnterpriseDB: The Definitive Reference" by Rampant TechPress.

Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.



Remote DBA Service

Oracle Tuning Book


Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software







BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.

Hit Counter