0
votes

I've a SQL script with some special chars, the original encoding is WE8MSWIN1252, inside one script I have this char 'Ç'. When I execute a script with this char, my Oracle database encoding is AL32UTF8, if the client encoding is AL32UTF8 I will get a wrong char in database.

With this process, I need to adapt the environment variable each time I need to compile this script.

I'm looking for a more flexible approach, I want to have environment variable and the database set to AL32UTF8, and then adapt/convert the file from ANSI to UTF8. But I can't executed the script having the correct char in the database.

Do you know how can I do this, or configure something that is flexible to execute script with different special chars without changing the environment variable?

Thanks,

1

1 Answers

0
votes

You can do this all in command line or but it into a single BAT file.

Would be like this:

C:\>chcp 1252
Active Codepage: 1252.

C:\>set NLS_LANG=.WE8MSWIN1252

C:\>sqlplus user/pwd@db @<your_sql_script_in_ANSI_encoding.sql>

C:\>exit

NLS_LANG is WE8MSWIN1252 only while you command line window is open.