Clip size in bytes

I have a database with the below NLS settings

NLS_NCHAR_CHARACTERSET  - AL16UTF16

NLS_CHARACTERSET - AL32UTF8

      

There is a table with a clob column that stores base64 data . Since the characters are mostly English and letters, I would assume each character takes 1 byte only as a clob, using NLS_CHARACTERSET encoding to encode.

With the built-in clob column, the clob will be stored in the row unless it is larger than 4096 bytes. However, when I tried to store the 2048 character dataset, I found that it was not stored in a row (by checking the DBA_TABLES table). Does this mean that each character does not use only 1 byte? Can anyone clarify this?

Another test: Create a table with a clob column with an 8kb block size so that the initial segment size is 65536 bytes. After inserting a string with 32,768 characters in the clob column. The creation of the second degree can be invoked by the dba_segments query.

+3


source to share


1 answer


http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch6unicode.htm#r2c1-t12

It says:



Data in CLOB columns is stored in a UCS-2-compatible format when the database character set is multibyte, such as UTF8 or AL32UTF8. This means the storage space required for the English Document is doubled when data is converted

So it looks like the CLOB internally stores everything as UCS-2 (Unicode), i.e. 2 bytes fixed per character. Hence, it stores 4096/2 = 2048 character lines.

+4


source







All Articles