Professional Documents
Culture Documents
David Berry
http://buildingbettersoftware.blogspot.com/
Module Introduction
Character sets,
Oracle RAW data
VARCHAR2 and
type
NVARCHAR2 types
Character Data Types in Oracle
Default
CHAR VARCHAR2
character set
Unicode
NCHAR NVARCHAR2
character set
Column Specifications
CHAR,
2000 bytes
NCHAR
4000 bytes
VARCHAR2,
NVARCHAR2 32,767 bytes
(Oracle 12c - MAX_STRING_SIZE=EXTENDED)
Attempt to insert/update
Oracle will throw an error
column with value longer
(data is not auto-truncated)
than column size
CHAR vs. VARCHAR2
I D A H O
5 bytes of data
I D A H O
16 bytes of data
Problems With Space Padded Data
SELECT *
FROM nls_database_parameters
WHERE parameter IN
('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET');
PARAMETER VALUE
------------------------- --------------------
NLS_CHARACTERSET WE8MSWIN1252
NLS_NCHAR_CHARACTERSET AL16UTF16
Character Set Properties
2000 bytes
Maximum Size 32,767 bytes
(Oracle 12c - MAX_STRING_SIZE=EXTENDED)
RAW Data Type