<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Database.fi &#187; Dump</title>
	<atom:link href="http://www.database.fi/tag/dump/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.database.fi</link>
	<description>Database Performance &#38; Disaster Solutions</description>
	<lastBuildDate>Tue, 25 Oct 2011 07:43:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Working with Unicode in Oracle</title>
		<link>http://www.database.fi/2010/03/working-with-unicode-in-oracle/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=working-with-unicode-in-oracle</link>
		<comments>http://www.database.fi/2010/03/working-with-unicode-in-oracle/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 21:42:36 +0000</pubDate>
		<dc:creator>pparkko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dump]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.database.fi/?p=14</guid>
		<description><![CDATA[I have been working mostly with “normal” character set databases.
The last project however uses Unicode database (AL32UTF8) in 11.2
I ran into this strange behaviour (until I knew better):
create table test(field varchar2(10));
Table created.
SQL> insert into testi values (&#8216;öäåÖÄÅ&#8217;);
insert into testi values (&#8216;öäåÖÄÅ&#8217;)
*
ERROR at line 1:
ORA-12899: value too large for column &#8220;&#8221;TEST&#8221;.&#8221;FIELD&#8221; (actual: 18,
maximum: 10)
SQL> insert into [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working mostly with “normal” character set databases.<br />
The last project however uses Unicode database (AL32UTF8) in 11.2<br />
I ran into this strange behaviour (until I knew better):</p>
<p>create table test(field varchar2(10));<br />
Table created.<br />
SQL> insert into testi values (&#8216;öäåÖÄÅ&#8217;);<br />
insert into testi values (&#8216;öäåÖÄÅ&#8217;)<br />
*<br />
ERROR at line 1:<br />
ORA-12899: value too large for column &#8220;&#8221;TEST&#8221;.&#8221;FIELD&#8221; (actual: 18,<br />
maximum: 10)<br />
SQL> insert into test values (&#8216;öä&#8217;);<br />
1 row created.<br />
So – I created a field for 10 characters (or so I thought!) and tried to store only 6 characters and failed.<br />
What an odd thing.<br />
Closer look tells that each character actually uses 3 bytes each:</p>
<p>SQL> select dump(field) from test;<br />
DUMP(KENTTA)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Typ=1 Len=6: 239,191,189,239,191,189<br />
1 row selected.<br />
All right, so it seems that there is actually space for only 10 BYTES – not characters…<br />
After 5 seconds of furious googling the reason is clear and my world shattered, again.<br />
The VARCHAR2(10) REALLY means VARCHAR2(10 BYTE).<br />
What I should have always used is VARCHAR2(10 CHAR).<br />
A new test:</p>
<p>create table test2 (field varchar2(10 char));<br />
=><br />
SQL> insert into test2 values(&#8216;öäåÖÄÅ&#8217;);<br />
1 row created.<br />
How embarrassing after so many years of working with Oracle  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.database.fi/2010/03/working-with-unicode-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

