mailar wrote:
HI,
Can anyone tell me how is a multi_byte to single byte and vice versa
conversion done in DB2.
It would be great even if someone can tell me how Oracle does it?
Oracle already has functions called to_single_byte and to_multi_byte
which convert a given multi byte character to single byte and vice
versa respectively.
thanks in advance
mailar
Mailar,
Do you mean between GRAPHIC and CHAR or between different encodings
within CHAR (and VARCHAR)?
Also Which platform are you on? In DB2 for LUW conversion is only done
implicitly between the client and the server. Only conversion to and
from BIT data can be done explicitly using the CAST() specification.
To cast from CHAR to GRAPHIC (and back) in a Unicode database usual cast
fucntions should work. GRAPHIC and CHAR are considered equivalent in
V8, btw)
In DB2 for zOS the CAST() specification can be used to cast to and from
Unicode as well using: CAST(c_db AS VARCHAR(10) CCSID UNICODE) or
CAST(c_uni AS VARCHAR(10) CCSID ASCII)
(DB2 zOS also supports a notation with SBCS and MBCS which I'm not very
familiar with. I believe it is legacy though)
I'm not familiar enough with DB2 for iSeries, but I think you can also
use CAST() and specify the CCSID by it's integer number. DB2 for iSeries
is leading the charge in this area.
Cheers
Serge