first introduces the next single-byte character set and multibyte character set
2.2 character encoding scheme
2.2.1 Single-byte encoding
(1) A single -byte 7-bit character set that can define 128 characters, the most commonly used character set is Us7ascii
(2) Single byte 8-bit character set, can be defined 256 characters, suitable for most European countries
Example:we8iso8859p1 (Western Europe,8-bit,ISO standard 8859P1 encoding )
2.2.2 multibyte encoding
(1) variable length multi-byte encoding
Some characters are expressed in one byte, other characters are represented by two or more characters, and variable length multibyte encoding is often used for support of Asian languages, such as Japanese, Chinese, Hindi, etc.
For example:Al32utf8 (where al stands for all, refers to all languages), zhs16cgb231280
(2) fixed-length multi-byte encoding
Each character uses a fixed-length byte encoding scheme, and currently Oracle's only supported fixed-size multibyte encoding is af16utf16, which is also used only for national character sets
2.2.3 Unicode Coding
Unicode is a single encoding scheme that covers all known characters currently used worldwide, i.e. Unicode provides a unique encoding for each character. UTF-16 is a Unicode 16-bit encoding, is a fixed-length multibyte encoding with 2 bytes representing a Unicode character, andAf16utf16 is a UTF-16 encoded character set.
UTF-8 is a Unicode 8-bit encoding, which is a variable-length multibyte-encoding that can represent a Unicode character in 1, 2,3 bytes ,Al32utf8,UTF8, Utfe is a UTF-8 coded character set
LENGTH
Syntax
length::=
Description of the illustration length.gif
Purpose
The length
functions return the LENGTH of Char
. length
calculates LENGTH using characters as defined by the input character set. LENGTHB
uses bytes instead of characters. lengthc
uses Unicode complete characters. length2
uses UCS2 code points. length4
uses UCS4 code points.
char
can be any of the data types char
, varchar2
, nchar
, nvarchar2
, clob
, or nclob
. The exceptions is lengthc
, length2
, and length4
, which do not allow char
to is a or nclob
. The return value is of data type number
. If char
have data type char
, then The length includes all trailing blanks. If char
is null and then this function returns NULL.
Restriction on LENGTHB The LENGTHB
function was supported for Single-byte lobs only. It cannot is used with CLOB
and NCLOB
data in a multibyte character set.
Examples
The following example uses the LENGTH
function using a single-byte database character set:
Select Length (' Candide ') "Length in characters" from DUAL; Length in characters-------------------- 7
The next example assumes a Double-byte database character set.
Select LENGTHB (' Candide ') "Length in bytes" from DUAL; Length in bytes--------------- 14
Oracle Official documentation-length article