-
Notifications
You must be signed in to change notification settings - Fork 0
/
ALTER_CHARACTERSET.sql
38 lines (30 loc) · 1.2 KB
/
ALTER_CHARACTERSET.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--Alterar CHARACTER_SET Oracle 11g
--Necessário conectar como SYS no SQLPlus
--sqlplus connect as sysdba:
--sqlplus OWNER/PASSWORD@TNSHOST as sysdba
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER DATABASE CHARACTER SET INTERNAL_USE WE8MSWIN1252;
ALTER SYSTEM DISABLE RESTRICTED SESSION;
--Conferir character set configurado na base
SELECT value
FROM nls_database_parameters
WHERE parameter = 'NLS_CHARACTERSET';
/*
Path regedit (if windows): Computador\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\oracle\KEY_OraClient11g_home1_32bit
or (if x64): Computador\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1
Change NLS_LANG for: AMERICAN_AMERICA.WE8MSWIN1252
or (for brazilian): BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
*/
--Code for alter session NLS_CHARACTERSET to consider CHAR for all columns (VARCHAR2(x CHAR)
--Details: https://pt.stackoverflow.com/a/438855/35358
declare
v_s_CharacterSet VARCHAR2(160);
begin
select VALUE
into v_s_CharacterSet
from NLS_DATABASE_PARAMETERS
where PARAMETER = 'NLS_CHARACTERSET';
if v_s_CharacterSet in ('UTF8', 'AL32UTF8') then
execute immediate 'alter session set nls_length_semantics=char';
end if;
end;