The VARCHAR2 datatype holds variable-length character string data.
The VARCHAR2 datatype typically uses 1 byte per character.
The VARCHAR2 datatype has a maximum length of 32767 bytes.
The Syntax for the VARCHAR2 Datatype
variable_name VARCHAR2(size);
variable_name is the name you want to give to the variable.
size is the maximum length, in bytes, of the string.
Here are some examples:
employee_name VARCHAR2(32);
employee_comments VARCHAR2(10000);
employee_name := 'Joe';
employee_name := 'YourName';
Oracle has two subtypes defined for VARCHAR2, which are
- VARCHAR
- STRING