Oracle 12c and the VARCHAR2 Data Type

By: Ian Abramson, Michael Abbey, Michelle Malcher, Michael Corey


VARCHAR2 is a variable-length alphanumeric data type. In PL/SQL, it may have a length up to 32,767 bytes. When you define the VARCHAR2 variable in the DECLARE section, remember to terminate the line with a semicolon (;). The following is the form of VARCHAR2 variable declarations:

p163-02

where MAX_LENGTH is a positive integer, as in

p163-03

You can also set an initial or default value for the variable. This is done on the same line as the variable declaration in the DECLARE section of your program. You can do this by using the following syntax:

p164-01

The preceding statement will set that value of the variable l_name to the value of ABRAMSON.

Leave a Reply