2

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.

Elmo N'diaye
  • 29
  • 1
  • 4
  • if you're using say, Windows terminal CMD prompt, you need to make sure windows encoding is ALSO set to Unicode - please describe your runtime environment and also version of Oracle – thatjeffsmith May 11 '22 at 17:46

2 Answers2

3

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 "?"

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
-1

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

doberkofler
  • 9,511
  • 18
  • 74
  • 126