Teste NLS_LANG

Nada de mais aqui, pessoal.
É só um teste com diversas configurações de NLS_LANG no cliente, para demonstrar que não basta que o banco de dados suporte certo tipo de caracteres, o cliente também deve ser configurado de acordo. E que depois de inserida as informações com o NLS errado, elas continuarão erradas no banco, mesmo usando o NLS_LANG correto depois.

C:\Users\ricar>set NLS_LANG=AMERICAN_AMERICA.US7ASCII

C:\Users\ricar>SQLPLUS SCOTT/TIGER@TESTE

SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 17 11:53:32 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Tue Dec 27 2016 18:42:04 -02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> CREATE TABLE T1 (NOME VARCHAR2(255));

Table created.

SQL> INSERT INTO T1 VALUES ('çáéíóúÂÊÎÔÛç');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SELECT NOME FROM T1;

NOME
--------------------------------------------------------------------------------
????????????

SQL> EXIT
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

C:\Users\ricar>set NLS_LANG=American_America.WE8ISO8859P1

C:\Users\ricar>SQLPLUS SCOTT/TIGER@TESTE

SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 17 11:55:18 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Fri Feb 17 2017 11:53:32 -02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT NOME FROM T1;

NOME
--------------------------------------------------------------------------------
┐┐┐┐┐┐┐┐┐┐┐┐

SQL> INSERT INTO T1 VALUES ('çáéíóúÂÊÎÔÛç');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SELECT NOME FROM T1;

NOME
--------------------------------------------------------------------------------
┐┐┐┐┐┐┐┐┐┐┐┐
┐á┐íóúÂÊÎÔÛ┐

SQL> EXIT
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

C:\Users\ricar>set NLS_LANG=PORTUGUESE_BRAZIL.WE8MSWIN1252

C:\Users\ricar>SQLPLUS SCOTT/TIGER@TESTE

SQL*Plus: Release 12.1.0.2.0 Production on Sex Fev 17 11:57:35 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Sex Fev 17 2017 11:55:18 -02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT NOME FROM T1;

NOME
--------------------------------------------------------------------------------
┐┐┐┐┐┐┐┐┐┐┐┐
┐á┐íóúÂÊÎÔÛ┐

SQL> INSERT INTO T1 VALUES ('çáéíóúÂÊÎÔÛç');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SELECT NOME FROM T1;

NOME
--------------------------------------------------------------------------------
┐┐┐┐┐┐┐┐┐┐┐┐
┐á┐íóúÂÊÎÔÛ┐
çáéíóúÂÊÎÔÛç

SQL>

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *