This topic describes how to create data of the VARCHAR2 type in PolarDB for Oracle.

Prerequisites

The VARCHAR2 data type is enabled by running the following statements. By default, PolarDB for Oracle does not support the VARCHAR2 data type.

alter system set polar_enable_varchar2_length_with_byte=on;
select pg_reload_conf();
show polar_enable_varchar2_length_with_byte;

Syntax

 VARCHAR2(maximum_size [CHAR | BYTE])

Parameters

Parameter Description
maximum_size The maximum length of the VARCHAR2 data type.
[CHAR | BYTE] The method that is used to measure the VARCHAR2 data length. Valid values: CHAR and BYTE.

Examples

create table t (col varchar2(10 byte));
create table t (col varchar2(10 char));