Varchar2

From Oracle FAQ
Jump to: navigation, search

VARCHAR2 is a data type used to store variable-length character data. A varchar2 value can contain up to 4000 bytes of data (limit in Oracle 7 was 2000 bytes).

[edit] Example

SQL> CREATE TABLE varchar2_test (col1 VARCHAR2(10));

Table created.

SQL> INSERT INTO varchar2_test VALUES ('qwerty');

1 row created.

[edit] Internal storage

VARCHAR2 data is stored as variable length values:

SQL> SELECT col1, length(col1), dump(col1) "ASCII Dump" FROM varchar2_test;

COL1       LENGTH(COL1) ASCII Dump
---------- ------------ ------------------------------------------------------------
qwerty                6 Typ=1 Len=6: 113,119,101,114,116,121

[edit] Also see

Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #