25.01.2014 Views

CCSID 102 – What's a CCSID and why do I care?

CCSID 102 – What's a CCSID and why do I care?

CCSID 102 – What's a CCSID and why do I care?

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Wednesday, March 29, 2006<br />

IBM Software Group | DB2 Information Management Software<br />

CAST – Changing a <strong>CCSID</strong><br />

• If both the length <strong>and</strong> <strong>CCSID</strong> clauses are specified, the data is<br />

first cast to the specified <strong>CCSID</strong>, <strong>and</strong> then the length is applied.<br />

Example:<br />

CAST (‘Jürgen’ as VARCHAR(6) <strong>CCSID</strong> UNICODE)<br />

Returns ‘Jürge’<br />

• If either CODEUNITS32 or CODEUNITS16 is specified, the<br />

specification of length applies to the units specified.<br />

Example:<br />

CAST (‘Jürgen’ as VARCHAR(6 CODEUNITS16) <strong>CCSID</strong> UNICODE)<br />

Returns ‘Jürgen’<br />

When a length is specified as part of a CAST that also specifies a <strong>CCSID</strong>, the<br />

length is applied after the data has been converted to the target <strong>CCSID</strong>, unless<br />

CODEUNITS16 or CODEUNITS32 is specified. If CODEUNITS16 or<br />

CODEUNITES32 is specified, then the length applies in the specified units, then<br />

the data is cast to the final <strong>CCSID</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!