2

Is it possible to insert the "€" (as a VARCHAR) in a Oracle Database whose character set is : ISO-8859-1 ?

I want to move from ISO-8859-1 to ISO-8859-15 charset (or even WINDOWS-1252 charset will fit) my database in order to store the "€" in my database, but one told me that with a ISO-8859-1 charset for the database, it WOULD BE possible to store directly my "€" char.

So the problem is that for the moment, I am trying to find this solution for the ISO-8859-1 database > There would be a mean to insert the "€" (depending on charset of the clients/drivers/etc., but not depending on the charset of the database)

What is your point of view about that.. ?

If it is true, then why do we have to define a character set for the Oracle database ? One told me that this is just for Oracle "to know how many bytes are needed to encode the character" (and therefore to choose a charset is equivalent to only choose a number of bits for Oracle to encode each character. conclusion: ISO-8859-1 = ISO-8859-15-WINDOWS = 1252 in some ways for Oracle because the number of needed bits are the same...)

I hope I am (almost) clear.. But in my opinion I think that I will never be able to perform an INSERT (with "€") and SELECT and retrieve my "€" on a ISO-8859-1 database...

Thanks for reading me..

(PS: database is 10g version)

mnflz
  • 23
  • 1
  • 4
  • See: [Is there a way to store Unicode Text in an Oracle Database configured as 'US7ASCII'](http://stackoverflow.com/q/2681180/119634) – Vincent Malgrat Apr 29 '11 at 14:19

1 Answers1

4

The character is not assigned in ISO-8859-1. Therefore there is no way you can represent it. The same byte as in ISE-8859-15 is used to represent ¤ (monetary general symbol).

Source

Oracle needs knowing in what character set it will encode the database for the following purposes:

  • Know on how many bytes to store each character
  • Being able to perform conversions when the clients NLS are different (some client is sending a query in UTF-8, with data that is valid ISO-8859-1: Oracle can translate it).
  • Packages that analyze column contents (like full text search) are sensitive to what character it is.
Benoit
  • 76,634
  • 23
  • 210
  • 236
  • I'm not really into databases, but I believe proper sorting with `ORDER BY` would also need to be aware of the encoding. – ollb Apr 29 '11 at 13:59
  • @Gnaoo: `ORDER BY` relies on the NLS_SORT client setting. – Benoit Apr 29 '11 at 14:48