Elmo N'diaye
Elmo N'diaye

Reputation: 49

Set charset to UTF-8 in SQL*Plus

I have a SQL script that contains the following statement:

insert into employee(fname,lname) values('Jörg','Müller');

My Database Charset ist set to AL32UTF8 but when I execute the script in SQLPlus the german letters Ö and Ü are not saved correctly. How can I set the Charset of SQLPlus to UTF-8?

Is it possible to set the SQL*Plus Charset to UTF-8 in my script file (the sql script file contains the command to set the charset to UTF-8)?

My runtime environment is Window but script should also be able to run on unix. My oracle version is 19c.

Upvotes: 4

Views: 10474

Answers (2)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59436

SQL*Plus inherits the character set from cmd window. You need to set encoding to UTF-8 and tell it Oracle. This is done by NLS_LANG parameter.

Try this:

chcp 65001
set NLS_LANG=.AL32UTF8
sqlplus ....

Of course, this works only if your sql-file is also saved as UTF-8. Otherwise you need to adapt character sets from above.

See OdbcConnection returning Chinese Characters as "?"

Upvotes: 7

doberkofler
doberkofler

Reputation: 10341

You would typically use the environment variable NLS_LANG and for example set it like this in windows: SET NLS_LANG=AMERICAN_AMERICA.AL32UTF8

Upvotes: -1

Related Questions