Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> 16Bit character set question

16Bit character set question

From: porschberg <thomas.porschberg_at_osp-dd.de>
Date: 28 May 2003 01:13:26 -0700
Message-ID: <8d9566f5.0305280013.7ee10814@posting.google.com>


Hi,
I have a 8.0.5 oracle database which character set is ZHT16BIG5 (16 Bit character set).

SELECT * FROM v$nls_parameters
WHERE PARAMETER IN ('NLS_CHARACTERSET','NLS_NCHAR_CHARACTERSET') gives me ZHT16BIG5 twice.

If I look at a certain VARCHAR2 field in a certain row I see 2 chinese signs (inside my tora-tool).

I did the following SQL-Statements:

SELECT LENGTH(myfiled) ...
==> gives 2 (ok, because 2 signs)

SELECT LENGTHB(myfield) ...
==> gives 4 (ok, because 4 bytes)

SELECT VSIZE(myfield) ...
==> gives 4 (ok, oracle needs 4 byte to store the values)

Now I fetched the value via C++/OTL, Perl/DBD and Java/JDBC to char-array/std::string (C++/OTL), character string (perl) and String (java) and checked the length of this fetched strings. The result is always 2 and not how I expected 4.

Further I checked the numeric values for the single bytes in the C/Perl string. The unsigned value is identical (191) for both bytes.

My questions:
Why I do not fetch 4 bytes for 2 signs if the values inside the database are stored in a 16bit manner ?

What must I be aware on client side (OCI/OTL,DBD::Oracle,JDBC) if the database stores its VARCHARS in multi-byte?

Is it allowed simply to fetch the values to a std::string in C++ (with OTL as a wrapper)?

Any help is welcome!
Thomas Received on Wed May 28 2003 - 03:13:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US