The VARCHAR data type is synonymous with the VARCHAR2 data VARCHAR2 . To avoid possible changes in behavior, always use the VARCHAR2 data VARCHAR2 to store variable-length character strings.
If your database works with a single-byte character set (for example, US7ASCII , WE8MSWIN1252 or WE8ISO8859P1 ), it does not matter if you VARCHAR2(x BYTE) or VARCHAR2(x CHAR) .
This only matters when your database is working with a multibyte character set (for example, AL32UTF8 or AL16UTF16 ). You can just see this in this example:
CREATE TABLE my_table ( VARCHAR2_byte VARCHAR2(1 BYTE), VARCHAR2_char VARCHAR2(1 CHAR) ); INSERT INTO my_table (VARCHAR2_char) VALUES ('β¬'); 1 row created. INSERT INTO my_table (VARCHAR2_char) VALUES ('ΓΌ'); 1 row created. INSERT INTO my_table (VARCHAR2_byte) VALUES ('β¬'); INSERT INTO my_table (VARCHAR2_byte) VALUES ('β¬') Error at line 10 ORA-12899: value too large for column "MY_TABLE"."VARCHAR2_BYTE" (actual: 3, maximum: 1) INSERT INTO my_table (VARCHAR2_byte) VALUES ('ΓΌ') Error at line 11 ORA-12899: value too large for column "MY_TABLE"."VARCHAR2_BYTE" (actual: 2, maximum: 1)
VARCHAR2(1 CHAR) means that you can store up to 1 character, no matter how many bytes it has. In the case of Unicode, one character can occupy up to 4 bytes.
VARCHAR2(1 BYTE) means that you can save a character that takes up max. 1 byte
If you do not specify either BYTE or CHAR then the default value is taken from the NLS_LENGTH_SEMANTICS session NLS_LENGTH_SEMANTICS .
If you do not have Oracle 12c, where you can set MAX_STRING_SIZE=EXTENDED limit will be VARCHAR2(4000 CHAR)
However, VARCHAR2(4000 CHAR) does not mean that you are guaranteed to save up to 4000 characters. The limit is still 4000 bytes , so in the worst case, you can only store up to 1000 characters in this field.
Check out this example ( β¬ in UTF-8 takes 3 bytes):
CREATE TABLE my_table2(VARCHAR2_char VARCHAR2(4000 CHAR)); BEGIN INSERT INTO my_table2 VALUES ('β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬'); FOR i IN 1..7 LOOP UPDATE my_table2 SET VARCHAR2_char = VARCHAR2_char ||VARCHAR2_char; END LOOP; END; / SELECT LENGTHB(VARCHAR2_char) , LENGTHC(VARCHAR2_char) FROM my_table2; LENGTHB(VARCHAR2_CHAR) LENGTHC(VARCHAR2_CHAR)
See Also Examples and Limitations of Using BYTE and CHAR Semantics (NLS_LENGTH_SEMANTICS) (Document ID 144808.1)