Dumitru Gutu
Dumitru Gutu

Reputation: 579

special characters oracle

see I inserted a special character "µ" into my table over Oracle database:

INSERT INTO ABBREV (ABBREV, DEFINITION) VALUES ('µg','microgram (one millionth of a gram, 10-6 gram)');
INSERT INTO ABBREV (ABBREV, DEFINITION) VALUES ('µmole','micromole');

when I select the data I get:

SQL> select * from ABBREV where DEFINITION like '%micro%';

ABBREV                         DEFINITION
------------------------------ --------------------------------------------------------------------------------
omi                            other micro-organisms
¿µg                            microgram (one millionth of a gram, 10 -6 gram)
¿µmole                         micromole

SQL> 

why I get "¿" before "µ" and how to avoid it in insert statement ?

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
NLS_NCHAR_CHARACTERSET         AL16UTF16

Upvotes: 0

Views: 1551

Answers (1)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59557

For a proper solution you have to set your NLS_LANG environment variable according to your local codepage.

It looks like this:

C:\>chcp
Active code page: 850

C:\>set NLS_LANG=.WE8PC850

C:\>sqlplus ...

SQL> INSERT INTO ABBREV (ABBREV, DEFINITION) VALUES ('µmole','micromole');

1 row created.

SQL> 

Another solution is to use function UNISTR:

INSERT INTO ABBREV (ABBREV, DEFINITION) VALUES (UNISTR('\00B5mole'),'micromole');

Upvotes: 2

Related Questions