Oracle9i Application Developer's Guide - Large Objects (LOBs)
Release 1 (9.0.1)

Part Number A88879-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Basic LOB Components, 3 of 5


Varying-Width Character Data

CLOB, NCLOB Values are Stored Using 2 Byte Unicode for Varying-Width Character Sets

CLOB/NCLOB values are stored in the database using the fixed width 2 byte Unicode character set if the database CHAR/NCHAR character set is varying-width.

NCLOBs store fixed-width data.

You can perform all LOB operations on CLOBs (read, write, trim, erase, compare,...) All programmatic environments that provide access to CLOBs work on CLOBs in databases where the CHAR/NCHAR character set is of varying-width. This includes SQL, PL/SQL, OCI, PRO*C, DBMS_LOB, and so on.

For varying-width CLOB data you need to also consider whether the parameters are specified in characters or bytes.

UTF-16 has same encoding as UCS2, but UTF-16 treats a surrogate pair as one character.

To summarize how CLOB and NCLOB values are stored:

Using DBMS_LOB.LOADFROMFILE and Functions that Access OCI

In using the OCI, or any of the programmatic environments that access OCI functionality, character set conversions are implicitly performed when translating from one character set to another. However, no implicit translation is ever performed from binary data to a character set. When you use the loadfromfile operation to populate a CLOB or NCLOB, you are populating the LOB with binary data from the BFILE. In that case, you will need to perform character set conversions on the BFILE data before executing loadfromfile.

Note that if the character set is varying-width, UTF-8 for example, we store the lob value in the fixed-width UCS2 format.

Therefore, the data in the BFILE should be in the UCS2 character set instead of the UTF-8 character set if you're using dbms_lob.loadfromfile().

However, we recommend that you use the sql*loader instead of loadfromfile to load data into a clob/nclob because the sql*loader will take care of all necessary character set conversions.

Converting Between Client Character Set and UCS-2

There are APIs in cartridge service that can convert between client character set and UCS-2:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback