Quick Search:
 The Oracle CHAR Data Type      [Return To Index] Jump to:  

Term: CHAR

The CHAR data type is used for storing fixed length character strings with a maximum size of 2000 bytes. String values will be space-padded before being stored on disk. When declaring a CHAR, the size must be specified, as shown in this example syntax:

CREATE TABLE test (column_1 CHAR(10));

This creates a CHAR column with a maximum data size of 10 characters.
Since data stored in a CHAR is space-padded, it is an inefficient way to store variable length strings. It is much more efficient to use the VARCHAR2 data type when storing variable-length strings.

Also See:
Definition & Examples: VARCHAR2 Data Type
Definition & Examples: VARCHAR Data Type

Related Links:

Related Code Snippets:
  • Date Functions: TO_CHAR - Converts DATE and TIMESTAMP to VARCHAR2 with the specified format.
  • Date Functions: TO_NCHAR - Converts a DATE or TIMESTAMP from the database character set to the Na...
  • String Functions: CHAR - Returns the character assigned to an ASCII number.
  • CHARTOROWID - CHARTOROWID converts a value from CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to RO...
  • ROWIDTOCHAR - ROWIDTOCHAR converts a rowid value to VARCHAR2 datatype. The result of this conversi...
  • ROWIDTONCHAR - ROWIDTONCHAR converts a rowid value to NVARCHAR2 datatype. The result of this conv...
  • TO_CHAR - Converts NCHAR, NVARCHAR2, CLOB, or NCLOB data to the database character set. The value ...
  • TO_NCHAR - Converts a character string, CHAR, VARCHAR2, CLOB, or NCLOB value to the national chara...
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org